Exemplo n.º 1
0
        public static IAppBuilder UseShibbolethAuthentication(this IAppBuilder app, SSOAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var resolver = ApplicationConfiguration.Instance.DependencyResolver;

            app.Use((object)typeof(SSOOwinMiddleware), (object)app, (object)options, resolver);

            app.Map(options.SPMetadataPath, a =>
            {
                a.Run(c =>
                {
                    var federationParty    = FederationPartyIdentifierHelper.GetFederationPartyIdFromRequestOrDefault(c);
                    var metadataGenerator  = SSOAuthenticationExtensions.ResolveMetadataGenerator <ISPMetadataGenerator>();
                    c.Response.ContentType = "text/xml";
                    var metadataRequest    = new MetadataGenerateRequest(MetadataType.SP, federationParty, new MetadataPublishContext(c.Response.Body, MetadataPublishProtocol.Http));
                    return(metadataGenerator.CreateMetadata(metadataRequest));
                });
            });
            return(app);
        }
Exemplo n.º 2
0
        public static IAppBuilder UseSaml2SSOAuthentication(this IAppBuilder app, string ssoEndpoint, params string[] assertionEndpoints)
        {
            var options = new SSOAuthenticationOptions
            {
                SSOPath = new PathString(ssoEndpoint)
            };

            foreach (var s in assertionEndpoints)
            {
                options.AssertionEndpoinds.Add(new PathString(s));
            }
            return(app.UseSaml2SSOAuthentication(options));
        }
Exemplo n.º 3
0
        public static IAppBuilder UseSaml2SSOAuthentication(this IAppBuilder app, SSOAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var resolver = ApplicationConfiguration.Instance.DependencyResolver;

            app.Use((object)typeof(SSOOwinMiddleware), (object)options, resolver);

            return(app);
        }
Exemplo n.º 4
0
        public static IAppBuilder UseShibbolethAuthentication(this IAppBuilder app, SSOAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var resolver = ApplicationConfiguration.Instance.DependencyResolver;

            app.Use((object)typeof(SSOOwinMiddleware), (object)app, (object)options, resolver);

            app.Map(options.SPMetadataPath, a =>
            {
                a.Run(c =>
                {
                    var metadataGenerator = SSOAuthenticationExtensions.ResolveMetadataGenerator <ISPMetadataGenerator>();
                    return(metadataGenerator.CreateMetadata(MetadataType.SP));
                });
            });
            return(app);
        }