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 void Configuration(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = "cookies" }); app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions { Wtrealm = "urn:encryptedrealmV2", MetadataAddress = "https://localhost:44388/wsfed/metadata", Wreply = "https://localhost:44344/", SignInAsAuthenticationType = "cookies", TokenValidationParameters = new TokenValidationParameters { AuthenticationType = "cookies", ClientDecryptionTokens = new ReadOnlyCollection <SecurityToken>(new List <SecurityToken> { new X509SecurityToken(Cert.LoadEncrypting()) }) } }); }