public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
            {
                var factory = InMemoryFactory.Create(
                    clients: Clients.Get(),
                    scopes: Scopes.Get());

                //var userService = new ExternalRegistrationUserService();
                //var userService = new EulaAtLoginUserService();
                var userService = new LocalRegistrationUserService();
                factory.UserService = Registration.RegisterFactory<IUserService>(() => userService);

                var options = new IdentityServerOptions
                {
                    IssuerUri = "https://idsrv3.com",
                    SiteName = "Thinktecture IdentityServer v3 - CustomUserService",
                    PublicHostName = "http://localhost:3333",
                    SigningCertificate = Certificate.Get(),
                    Factory = factory,
                    AdditionalIdentityProviderConfiguration = ConfigureAdditionalIdentityProviders,
                    CorsPolicy = CorsPolicy.AllowAll,
                    AuthenticationOptions = new AuthenticationOptions {
                        LoginPageLinks = new LoginPageLink[] { 
                            new LoginPageLink{
                                Text = "Register",
                                Href = "localregistration"
                            }
                        }
                    }
                };

                coreApp.UseIdentityServer(options);
            });
        }
示例#2
0
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
            {
                var factory = InMemoryFactory.Create(
                    clients: Clients.Get(),
                    scopes: Scopes.Get());

                //var userService = new ExternalRegistrationUserService();
                //var userService = new EulaAtLoginUserService();
                var userService     = new LocalRegistrationUserService();
                factory.UserService = Registration.RegisterFactory <IUserService>(() => userService);

                var options = new IdentityServerOptions
                {
                    IssuerUri          = "https://idsrv3.com",
                    SiteName           = "Thinktecture IdentityServer v3 - CustomUserService",
                    PublicHostName     = "http://localhost:3333",
                    SigningCertificate = Certificate.Get(),
                    Factory            = factory,
                    AdditionalIdentityProviderConfiguration = ConfigureAdditionalIdentityProviders,
                    CorsPolicy            = CorsPolicy.AllowAll,
                    AuthenticationOptions = new AuthenticationOptions {
                        LoginPageLinks = new LoginPageLink[] {
                            new LoginPageLink {
                                Text = "Register",
                                Href = "localregistration"
                            }
                        }
                    }
                };

                coreApp.UseIdentityServer(options);
            });
        }
        public void Configuration(IAppBuilder app)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Trace()
                         .CreateLogger();

            app.Map("/core", coreApp =>
            {
                var factory = new IdentityServerServiceFactory()
                              .UseInMemoryClients(Clients.Get())
                              .UseInMemoryScopes(Scopes.Get());

                // different examples of custom user services
                //var userService = new RegisterFirstExternalRegistrationUserService();
                //var userService = new ExternalRegistrationUserService();
                //var userService = new EulaAtLoginUserService();
                var userService = new LocalRegistrationUserService();

                factory.UserService       = new Registration <IUserService>(resolver => userService);
                factory.CorsPolicyService = new Registration <ICorsPolicyService>(new DefaultCorsPolicyService {
                    AllowAll = true
                });

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer3 - CustomUserService",

                    SigningCertificate = Certificate.Get(),
                    Factory            = factory,

                    AuthenticationOptions = new AuthenticationOptions
                    {
                        IdentityProviders = ConfigureAdditionalIdentityProviders,
                        LoginPageLinks    = new LoginPageLink[] {
                            new LoginPageLink {
                                Text = "Register",
                                //Href = "~/localregistration"
                                Href = "localregistration"
                            }
                        }
                    },

                    EventsOptions = new EventsOptions
                    {
                        RaiseSuccessEvents     = true,
                        RaiseErrorEvents       = true,
                        RaiseFailureEvents     = true,
                        RaiseInformationEvents = true
                    }
                };

                coreApp.UseIdentityServer(options);
            });
        }
        public void Configuration(IAppBuilder app)
        {
            Log.Logger = new LoggerConfiguration()
                           .MinimumLevel.Debug()
                           .WriteTo.Trace()
                           .CreateLogger();

            app.Map("/core", coreApp =>
            {
                var factory = new IdentityServerServiceFactory()
                    .UseInMemoryClients(Clients.Get())
                    .UseInMemoryScopes(Scopes.Get());

                // different examples of custom user services
                //var userService = new RegisterFirstExternalRegistrationUserService();
                //var userService = new ExternalRegistrationUserService();
                //var userService = new EulaAtLoginUserService();
                var userService = new LocalRegistrationUserService();
                
                factory.UserService = new Registration<IUserService>(resolver => userService);
                factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer3 - CustomUserService",

                    SigningCertificate = Certificate.Get(),
                    Factory = factory,
                    
                    AuthenticationOptions = new AuthenticationOptions
                    {
                        IdentityProviders = ConfigureAdditionalIdentityProviders,
                        LoginPageLinks = new LoginPageLink[] { 
                            new LoginPageLink{
                                Text = "Register",
                                //Href = "~/localregistration"
                                Href = "localregistration"
                            }
                        }
                    },

                    EventsOptions = new EventsOptions
                    {
                        RaiseSuccessEvents = true,
                        RaiseErrorEvents = true,
                        RaiseFailureEvents = true,
                        RaiseInformationEvents = true
                    }
                };

                coreApp.UseIdentityServer(options);
            });
        }