Esempio n. 1
0
        private void ConfigureWsFederation(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var factory = new WsFederationServiceFactory(options.Factory);

            factory.Register(new Registration <IEnumerable <RelyingParty> >(RelyingParties.Get()));
            factory.RelyingPartyService = new Registration <IRelyingPartyService>(typeof(InMemoryRelyingPartyService));
            pluginApp.UseWsFederationPlugin(new WsFederationPluginOptions {
                IdentityServerOptions = options, Factory = factory
            });
        }
Esempio n. 2
0
        private static void PluginConfiguration(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var relyingParties = new List <RelyingParty>
            {
                new RelyingParty
                {
                    Realm     = "urn:encryptedrealmV1",
                    ReplyUrl  = "https://localhost:44344/",
                    TokenType = TokenTypes.Saml11TokenProfile11,
                    DefaultClaimTypeMappingPrefix = "http://local.schema.org/",
                    IncludeAllClaimsForUser       = true,
                    ClaimMappings =
                        new Dictionary <string, string> {
                        { "sub", ClaimTypes.NameIdentifier },
                        { "name", ClaimTypes.Name },
                        { "given_name", ClaimTypes.GivenName },
                        { "family_name", ClaimTypes.Surname },
                        { "email", ClaimTypes.Email }
                    },
                    EncryptingCertificate = Cert.LoadEncrypting()
                },
                new RelyingParty
                {
                    Realm     = "urn:encryptedrealmV2",
                    ReplyUrl  = "https://localhost:44344/",
                    TokenType = TokenTypes.Saml2TokenProfile11,
                    DefaultClaimTypeMappingPrefix = "http://local.schema.org/",
                    IncludeAllClaimsForUser       = true,
                    ClaimMappings =
                        new Dictionary <string, string> {
                        { "sub", ClaimTypes.NameIdentifier },
                        { "name", ClaimTypes.Name },
                        { "given_name", ClaimTypes.GivenName },
                        { "family_name", ClaimTypes.Surname },
                        { "email", ClaimTypes.Email }
                    },
                    EncryptingCertificate = Cert.LoadEncrypting()
                }
            };

            var factory = new WsFederationServiceFactory(options.Factory);

            factory.Register(new Registration <IEnumerable <RelyingParty> >(relyingParties));
            factory.RelyingPartyService = new Registration <IRelyingPartyService>(typeof(InMemoryRelyingPartyService));

            pluginApp.UseWsFederationPlugin(new WsFederationPluginOptions
            {
                IdentityServerOptions = options,
                Factory = factory,
                EnableMetadataEndpoint = true
            });
        }
        public static void RegisterRelyingPartyService(this WsFederationServiceFactory factory,
                                                       EntityFrameworkServiceOptions options)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            factory.Register(new Registration <IRelyingPartyConfigurationDbContext>(resolver => new RelyingPartyConfigurationDbContext(options.ConnectionString, options.Schema)));
            factory.RelyingPartyService = new Registration <IRelyingPartyService, RelyingPartyService>();
        }
        private void ConfigureWsFederation(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var factory = new WsFederationServiceFactory(options.Factory);

            factory.RelyingPartyService = new Registration<IRelyingPartyService>(typeof(RelyingPartiesService));

            var wsFedOptions = new WsFederationPluginOptions
            {
                IdentityServerOptions = options,
                Factory = factory
                
            };

            pluginApp.UseWsFederationPlugin(wsFedOptions);

        }
Esempio n. 5
0
        private void ConfigureWsFederation(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var factory = new WsFederationServiceFactory(options.Factory)
            {
                RelyingPartyService = new Registration <IRelyingPartyService>(typeof(InMemoryRelyingPartyService))
            };

            factory.UseInMemoryRelyingParties(GetWsFedRelyingParties());

            var wsFedOptions = new WsFederationPluginOptions
            {
                IdentityServerOptions = options,
                Factory = factory,
                EnableMetadataEndpoint = true
            };

            pluginApp.UseWsFederationPlugin(wsFedOptions);
        }
        private void ConfigurePlugins(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var factory = new WsFederationServiceFactory
            {
                UserService         = options.Factory.UserService,
                RelyingPartyService = Registration.RegisterType <IRelyingPartyService>(typeof(InMemoryRelyingPartyService))
            };

            // data sources for in-memory services
            factory.Register(Registration.RegisterSingleton <IEnumerable <RelyingParty> >(RelyingParties.Get()));

            var wsFedOptions = new WsFederationPluginOptions
            {
                IdentityServerOptions = options,
                Factory = factory
            };

            pluginApp.UseWsFederationPlugin(wsFedOptions);
        }
        private static void ConfigurePlugins(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var efConfig = new EntityFrameworkServiceOptions
            {
                ConnectionString = "IdSvr3Config"
            };

            // pre-populate the test DB from the in-memory config
            ConfigureRelyingParties(RelyingParties.Get(), efConfig);

            var factory = new WsFederationServiceFactory(options.Factory);

            factory.RegisterRelyingPartyService(efConfig);

            var wsFedOptions = new WsFederationPluginOptions(options)
            {
                Factory = factory
            };

            pluginApp.UseWsFederationPlugin(wsFedOptions);
        }
        private static void PluginConfiguration(IAppBuilder pluginApp, IdentityServerOptions options)
        {
            var relyingParties = new List<RelyingParty>
            {
                new RelyingParty
                {
                    Realm = "urn:encryptedrealmV1",
                    ReplyUrl = "https://localhost:44344/",
                    TokenType = TokenTypes.Saml11TokenProfile11,
                    DefaultClaimTypeMappingPrefix = "http://local.schema.org/",
                    IncludeAllClaimsForUser = true,
                    ClaimMappings =
                    new Dictionary<string, string> {
                        { "sub", ClaimTypes.NameIdentifier },
                        { "name", ClaimTypes.Name },
                        { "given_name", ClaimTypes.GivenName },
                        { "family_name", ClaimTypes.Surname },
                        { "email", ClaimTypes.Email }
                    },
                    EncryptingCertificate = Cert.LoadEncrypting()
                },
                new RelyingParty
                {
                    Realm = "urn:encryptedrealmV2",
                    ReplyUrl = "https://localhost:44344/",
                    TokenType = TokenTypes.Saml2TokenProfile11,
                    DefaultClaimTypeMappingPrefix = "http://local.schema.org/",
                    IncludeAllClaimsForUser = true,
                    ClaimMappings =
                    new Dictionary<string, string> {
                        { "sub", ClaimTypes.NameIdentifier },
                        { "name", ClaimTypes.Name },
                        { "given_name", ClaimTypes.GivenName },
                        { "family_name", ClaimTypes.Surname },
                        { "email", ClaimTypes.Email }
                    },
                    EncryptingCertificate = Cert.LoadEncrypting()
                }
            };

            var factory = new WsFederationServiceFactory(options.Factory);
            factory.Register(new Registration<IEnumerable<RelyingParty>>(relyingParties));
            factory.RelyingPartyService = new Registration<IRelyingPartyService>(typeof (InMemoryRelyingPartyService));

            pluginApp.UseWsFederationPlugin(new WsFederationPluginOptions
            {
                IdentityServerOptions = options,
                Factory = factory,
                EnableMetadataEndpoint = true
            });
        }