using System.Collections.Generic; using System.Security.Claims; using IdentityModel; using IdentityServer4; using IdentityServer4.Models; namespace OpenAuth.IdentityServer { public static class Config { #region scopes public static IEnumerable ApiScopes => new List { new ApiScope("api1", "My API") }; #endregion #region clients /// /// 客户端信息 /// /// public static IEnumerable GetClients() { return new[] { new Client { ClientId = "weigh", AllowedGrantTypes = GrantTypes.ClientCredentials, ClientSecrets = { new Secret("jibeikuangchang".Sha256()) }, AllowedScopes = { "api1" } } }; } #endregion #region Resources public static IEnumerable GetIdentityResources() { return new IdentityResource[] { new IdentityResources.OpenId(), new IdentityResources.Profile(), }; } #endregion #region Api /// /// API信息 /// /// public static IEnumerable GetApis() { return new[] { new ApiResource("openauthapi", "OpenAuth.WebApi") { UserClaims = { ClaimTypes.Name, JwtClaimTypes.Name } } }; } #endregion } }