示例#1
0
        public static IEnumerable <IdentityResource> GetIdentityResources(IConfiguration configuration)
        {
            var resourcesConfig = new List <string>();

            configuration.GetSection("ApplicationSettings").GetSection("AuthConfig").GetSection("IdentityResources").Bind(resourcesConfig);

            return(resourcesConfig.Select(r => AuthVariables.GetIdentityResource(r)).ToArray());
        }
示例#2
0
        public static IEnumerable <Client> GetClients(IConfiguration configuration)
        {
            var resourcesConfig = new List <ClientAuthConfig>();

            configuration.GetSection("ApplicationSettings").GetSection("AuthConfig").GetSection("Clients").Bind(resourcesConfig);

            return(resourcesConfig.Select(r => new Client
            {
                ClientId = r.ClientId,
                ClientName = r.ClientName,
                ClientSecrets = r.ClientSecrets,
                AllowedGrantTypes = AuthVariables.GetAllowedGrantTypes(r.AllowedGrantTypesName),
                AllowedScopes = r.AllowedScopes,
                AllowAccessTokensViaBrowser = r.AllowAccessTokensViaBrowser,
                RedirectUris = r.RedirectUris,
                PostLogoutRedirectUris = r.PostLogoutRedirectUris,
                AllowedCorsOrigins = r.AllowedCorsOrigins,
                RequireConsent = r.RequireConsent
            }));
        }