/// <summary>
        /// Adds the <see cref="SAMLAuthenticationMiddleware"/> into the OWIN runtime.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param>
        /// <param name="wsFederationOptions">SAMLAuthenticationOptions configuration options</param>
        /// <returns>The updated <see cref="IAppBuilder"/></returns>
        public static IAppBuilder UseSAML2Authentication(this IAppBuilder app, SAML2AuthenticationOptions wsFederationOptions)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (wsFederationOptions == null)
            {
                throw new ArgumentNullException("wsFederationOptions");
            }

            if (string.IsNullOrWhiteSpace(wsFederationOptions.TokenValidationParameters.ValidAudience))
            {
                wsFederationOptions.TokenValidationParameters.ValidAudience = wsFederationOptions.Wtrealm;
            }

            return(app.Use <SAML2AuthenticationMiddleware>(app, wsFederationOptions));
        }
Exemplo n.º 2
0
 public SAML2IdentityProvider(IOptions <SAML2AuthenticationOptions> options)
 {
     this.options = options.Value;
 }