public static IIdentityServerBuilder Configure(this IIdentityServerBuilder identityServerBuilder) { identityServerBuilder .AddDeveloperSigningCredential() //.AddProfileService<>(), .AddInMemoryIdentityResources(InMemoryResources.GetIdentityResources()) .AddInMemoryApiResources(InMemoryResources.GetApiResources()) .AddInMemoryClients(InMemoryResources.GetClients()) .AddExtensionGrantValidator <RFC7523GrantValidator>(); return(identityServerBuilder); }
// 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(); }