Exemple #1
0
        public void Configuration(IAppBuilder app)
        {
            // tracing
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Trace()
                         .CreateLogger();

            // in-memory datenhaltung für users, scopes, clients und CORS policys
            var users   = new InMemoryUserService(Users.Get());
            var scopes  = new InMemoryScopeStore(Scopes.Get());
            var clients = new InMemoryClientStore(Clients.Get());
            var cors    = new InMemoryCorsPolicyService(Clients.Get());

            // konfigurieren der factory
            var factory = new IdentityServerServiceFactory();

            factory.UserService       = new Registration <IUserService>(users);
            factory.ScopeStore        = new Registration <IScopeStore>(scopes);
            factory.ClientStore       = new Registration <IClientStore>(clients);
            factory.CorsPolicyService = new Registration <ICorsPolicyService>(cors);

            // identityserver3 middleware einbinden
            app.UseIdentityServer(new IdentityServerOptions
            {
                Factory  = factory,
                SiteName = "DotNetPro IdentityServer",

                SigningCertificate = Certificate.Get()
            });
        }
Exemple #2
0
        public void Configuration(IAppBuilder app)
        {
            var authServicesOptions = new KentorAuthServicesAuthenticationOptions(false)
            {
                SPOptions = new SPOptions
                {
                    EntityId = new EntityId("http://sp.example.com")
                },

                SignInAsAuthenticationType = "External",
                AuthenticationType         = "saml2p",
                Caption = "SAML2p"
            };

            authServicesOptions.IdentityProviders.Add(new IdentityProvider(new EntityId("http://stubidp.kentor.se/Metadata"), authServicesOptions.SPOptions)
            {
                LoadMetadata = true
            });


            var cors    = new InMemoryCorsPolicyService(Clients.Get());
            var factory = new IdentityServerServiceFactory()
                          .UseInMemoryClients(Clients.Get())
                          .UseInMemoryScopes(Scopes.Get())
                          .UseInMemoryUsers(Users.Get());

            factory.CorsPolicyService = new Registration <ICorsPolicyService>(cors);

            var options = new IdentityServerOptions
            {
                Factory = factory,
                AuthenticationOptions = new AuthenticationOptions()
                {
                    IdentityProviders = (appBuilder, signInAsType) =>
                    {
                        Kentor.AuthServices.Configuration.Options.GlobalEnableSha256XmlSignatures();
                        app.UseKentorAuthServicesAuthentication(authServicesOptions);
                    }
                },
                LoggingOptions = new LoggingOptions()
                {
                    EnableHttpLogging       = true,
                    EnableKatanaLogging     = true,
                    EnableWebApiDiagnostics = true
                }
            };

            app.UseIdentityServer(options);
        }
Exemple #3
0
        public void Configuration(IAppBuilder app)
        {
            app.Map(
                "/oauth/ls",
                coreApp =>
            {
                var inMem = new InMemoryCorsPolicyService(Clients.Get());

                var factory = new IdentityServerServiceFactory()
                              .UseInMemoryClients(Clients.Get())
                              .UseInMemoryScopes(Scopes.Get())
                              .UseInMemoryUsers(Users.Get());

                factory.CorsPolicyService = new Registration <ICorsPolicyService>(inMem);

                coreApp.UseIdentityServer(new IdentityServerOptions
                {
                    SiteName           = "Standalone Identity Server",
                    SigningCertificate = Cert.Load(),
                    Factory            = factory,
                    RequireSsl         = true,
                });
            });
        }
Exemple #4
0
 public InMemoryCorsPolicyServiceTests()
 {
     _subject = new InMemoryCorsPolicyService(TestLogger.Create <InMemoryCorsPolicyService>(), _clients);
 }
Exemple #5
0
 public InMemoryCorsPolicyServiceTests()
 {
     _subject = new InMemoryCorsPolicyService(new FakeLogger <InMemoryCorsPolicyService>(), _clients);
 }