Ejemplo n.º 1
0
        public static IAppBuilder UseIdentityServerCore(this IAppBuilder app, IdentityServerCoreOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            var internalConfig = new InternalConfiguration();

            // thank you Microsoft for the clean syntax
            JwtSecurityTokenHandler.InboundClaimTypeMap  = ClaimMappings.None;
            JwtSecurityTokenHandler.OutboundClaimTypeMap = ClaimMappings.None;

            app.UseCookieAuthentication(new CookieAuthenticationOptions {
                AuthenticationType = Constants.PrimaryAuthenticationType
            });
            app.UseCookieAuthentication(new CookieAuthenticationOptions {
                AuthenticationType = Constants.ExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive
            });
            app.UseCookieAuthentication(new CookieAuthenticationOptions {
                AuthenticationType = Constants.PartialSignInAuthenticationType, AuthenticationMode = AuthenticationMode.Passive
            });

            if (options.AdditionalIdentityProviderConfiguration != null)
            {
                options.AdditionalIdentityProviderConfiguration(app, Constants.ExternalAuthenticationType);
            }

            if (options.PluginConfiguration != null)
            {
                options.PluginConfiguration(app, internalConfig.PluginDependencies);
            }

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets"),
                FileSystem  = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets/libs/fonts"),
                FileSystem  = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets.libs.bootstrap.fonts")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.Use <AutofacContainerMiddleware>(AutofacConfig.Configure(options, internalConfig));
            Microsoft.Owin.Infrastructure.SignatureConversions.AddConversions(app);
            app.UseWebApi(WebApiConfig.Configure(options));

            return(app);
        }
        public void Configuration(IAppBuilder appBuilder)
        {
            var factory = LocalTestFactory.Create(
                issuerUri: "https://idsrv3.com",
                siteName: "Thinktecture IdentityServer v3 - preview 1 (SelfHost)",
                publicHostAddress: "http://localhost:3333");

            var opts = new IdentityServerCoreOptions
            {
                Factory = factory,
            };

            appBuilder.UseIdentityServerCore(opts);
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
            {
                var factory = TestOptionsFactory.Create(
                    issuerUri:         "https://idsrv3.com",
                    siteName:          "Thinktecture IdentityServer v3 - preview 1",
                    publicHostAddress: "http://localhost:3333");

                var opts = new IdentityServerCoreOptions
                {
                    Factory = factory,
                };

                coreApp.UseIdentityServerCore(opts);
            });
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
            {
                var factory = TestOptionsFactory.Create(
                    issuerUri: "https://idsrv3.com",
                    siteName: "Thinktecture IdentityServer v3 - preview 1 (WAWS)",
                    publicHostAddress: "http://idsrv3.azurewebsites.net");

                var options = new IdentityServerCoreOptions
                {
                    Factory = factory,
                    SocialIdentityProviderConfiguration = ConfigureSocialIdentityProviders
                };

                coreApp.UseIdentityServerCore(options);
            });
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
            {
                var factory = TestOptionsFactory.Create(
                    issuerUri: "https://idsrv3.com",
                    siteName: "Thinktecture IdentityServer v3 - preview 1",
                    publicHostAddress: "http://localhost:3333/core");

                //factory.UserService = Thinktecture.IdentityServer.MembershipReboot.UserServiceFactory.Factory;
                //factory.UserService = Thinktecture.IdentityServer.AspNetIdentity.UserServiceFactory.Factory;

                var options = new IdentityServerCoreOptions
                {
                    Factory = factory,
                    SocialIdentityProviderConfiguration = ConfigureSocialIdentityProviders
                };

                coreApp.UseIdentityServerCore(options);
            });
        }
        public void Configuration(IAppBuilder app)
        {
            LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider());

            app.Map("/core", coreApp =>
            {
                var factory = LocalTestFactory.Create(
                    issuerUri: "https://idsrv3.com",
                    siteName: "Thinktecture IdentityServer v3 - preview 1",
                    publicHostAddress: "http://localhost:3333/core");

                //factory.UserService = Thinktecture.IdentityServer.MembershipReboot.UserServiceFactory.Factory;
                //factory.UserService = Thinktecture.IdentityServer.AspNetIdentity.UserServiceFactory.Factory;

                var options = new IdentityServerCoreOptions
                {
                    Factory = factory,
                    AdditionalIdentityProviderConfiguration = ConfigureAdditionalIdentityProviders,
                    PluginConfiguration = ConfigurePlugins
                };

                coreApp.UseIdentityServerCore(options);
            });
        }