コード例 #1
0
        public static IIdentityServerBuilder Configure(this IIdentityServerBuilder identityServerBuilder)
        {
            identityServerBuilder
            .AddDeveloperSigningCredential()
            //.AddProfileService<>(),
            .AddInMemoryIdentityResources(InMemoryResources.GetIdentityResources())
            .AddInMemoryApiResources(InMemoryResources.GetApiResources())
            .AddInMemoryClients(InMemoryResources.GetClients())
            .AddExtensionGrantValidator <RFC7523GrantValidator>();

            return(identityServerBuilder);
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionStr = Configuration.GetConnectionString("DefaultConnection");

            var migrationAssembly = this.GetType().GetTypeInfo().Assembly.GetName().Name;

            services.AddDbContext <AutenticacaoDbContext>(options => { options.UseSqlServer(connectionStr, sqlOptions => sqlOptions.MigrationsAssembly(migrationAssembly)); });

            services
            .AddIdentityServer()
            .AddOperationalStore(options => { options.ConfigureDbContext = x => x.UseSqlServer(connectionStr, sqlOptions => sqlOptions.MigrationsAssembly(migrationAssembly)); })
            //  .AddConfigurationStore(options => { options.ConfigureDbContext = x => x.UseSqlServer(connectionStr, sqlOptions => sqlOptions.MigrationsAssembly(migrationAssembly)); })
            .AddProfileService <ContaProfileService>()
            .AddResourceOwnerValidator <ContaPasswordValidator>()
            .AddInMemoryApiResources(InMemoryResources.GetAPIResources())
            .AddInMemoryIdentityResources(InMemoryResources.GetIdentityResources())
            .AddInMemoryClients(InMemoryClients.GetClients())
            .AddDeveloperSigningCredential();
        }