ZhouliProject/Zhouli.Identity.Certification/Config.cs

(完整代码) 1KB

using IdentityServer4.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Zhouli.Identity.Certification
{
    public class Config
    {
        public static IEnumerable<ApiResource> GetApiResources()
        {
            return new ApiResource[] {
                new ApiResource("Zhouli.BlogWebApi", "周黎的博客Api"),
                new ApiResource("Zhouli.FileService", "周黎的文件服务Api")
            };
        }
        public static IEnumerable<Client> GetClients()
        {
            return new Client[] { new Client {
            ClientId = "zhouli",
            // 没有交互性用户,使用 clientid/secret 实现认证。
            AllowedGrantTypes = GrantTypes.ClientCredentials,
            // 用于认证的密码
            ClientSecrets =
            {
                new Secret("991022".Sha256())
            },
            // 客户端有权访问的范围(Scopes)
            AllowedScopes = { "Zhouli.BlogWebApi", "Zhouli.FileService" }
            } };
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。