Ejemplo 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
            });
        }
Ejemplo 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 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);
        }
Ejemplo n.º 5
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
            });
        }