Beispiel #1
0
 public SamlLogoutHandler(SamlAuthenticationOptions options)
     : base(options.Configuration)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     this.options = options;
 }
Beispiel #2
0
 /// <summary>
 /// Constructor for LoginHandler
 /// </summary>
 /// <param name="configuration">SamlConfiguration</param>
 /// <param name="getFromCache">May be null unless doing artifact binding, this function will be called for artifact resolution</param>
 public SamlLoginHandler(SamlAuthenticationOptions options)
 {
     if (options == null) throw new ArgumentNullException("options");
     this.options = options;
     configuration = options.Configuration;
     getFromCache = options.GetFromCache;
     setInCache = options.SetInCache;
     session = options.Session;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor for LoginHandler
 /// </summary>
 /// <param name="options">The authentication options.</param>
 public SamlLoginHandler(SamlAuthenticationOptions options)
     : base(options.Configuration)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     this.options = options;
     getFromCache = options.GetFromCache;
     setInCache   = options.SetInCache;
     session      = options.Session;
 }
        /// <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="options">Saml2Configuration configuration options</param>
        /// <returns>The updated <see cref="IAppBuilder"/></returns>
        public static IAppBuilder UseSamlAuthentication(this IAppBuilder app, SamlAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (options == null) throw new ArgumentNullException("options");

            SAML2.Logging.LoggerProvider.Configuration = SAML2.Logging.LoggerProvider.Configuration ?? options.Configuration;

            app.Map(options.MetadataPath, metadataapp => {
                metadataapp.Run(new SamlMetadataWriter(options.Configuration).WriteMetadataDocument);
            });

            return app.Use<SamlAuthenticationMiddleware>(app, options);
        }