private static void RegisterServices(IServiceCollection services, UmaHostConfiguration configuration) { // 1. Add CORE. services.AddSimpleIdServerUmaCore() .AddSimpleIdentityServerCore() .AddSimpleIdentityServerJwt(); // 2. Register DB & stores. services.AddUmaInMemoryEF(); services.AddOAuthInMemoryEF(); services.AddUmaInMemoryStore(); services.AddInMemoryStorage(); services.AddEventStoreInMemoryEF(); services.AddSimpleBusInMemory() .AddEventStoreBusHandler(new EventStoreHandlerOptions(ServerTypes.AUTH)); services.AddConcurrency(opt => opt.UseInMemory()); // 3. Enable logging. services.AddLogging(); services.AddIdServerLogging(); // 4. Register the services. services.AddTransient <SimpleIdentityServer.Core.Services.IConfigurationService, DefaultConfigurationService>(); services.AddTransient <SimpleIdentityServer.Core.Services.IAuthenticateResourceOwnerService, DefaultAuthenticateResourceOwnerService>(); // 5. Register other classes. services.AddTransient <IHostingProvider, HostingProvider>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddTransient <IUmaServerEventSource, UmaServerEventSource>(); services.AddTransient <IIdentityServerClientFactory, FakeIdentityServerClientFactory>(); }
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); builder.AddEnvironmentVariables(); Configuration = builder.Build(); _umaHostConfiguration = new UmaHostConfiguration(); }
private static void RegisterServices(IServiceCollection services, UmaHostConfiguration configuration) { services.AddSimpleIdServerUmaCore() .AddSimpleIdentityServerCore() .AddSimpleIdentityServerJwt() .AddIdServerClient(); services.AddIdServerLogging(); services.AddTransient <IHostingProvider, HostingProvider>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddTransient <IUmaServerEventSource, UmaServerEventSource>(); if (configuration.AuthenticateResourceOwner == null) { services.AddTransient <IAuthenticateResourceOwnerService, DefaultAuthenticateResourceOwerService>(); } else { services.AddTransient(typeof(IAuthenticateResourceOwnerService), configuration.AuthenticateResourceOwner); } if (configuration.ConfigurationService == null) { services.AddTransient <IConfigurationService, DefaultConfigurationService>(); } else { services.AddTransient(typeof(IConfigurationService), configuration.ConfigurationService); } if (configuration.PasswordService == null) { services.AddTransient <IPasswordService, DefaultPasswordService>(); } else { services.AddTransient(typeof(IPasswordService), configuration.PasswordService); } }
public static IServiceCollection AddUmaHost(this IServiceCollection services, UmaHostConfiguration configuration) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } // 1. Add the dependencies. RegisterServices(services, configuration); return(services); }
public FakeUmaStartup(SharedContext context) { _configuration = new UmaHostConfiguration(); _context = context; }