Пример #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);
        }
Пример #2
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);
        }
Пример #3
0
 public static IAppBuilder UseSaml2SSOAuthentication(this IAppBuilder app, params string[] assertionEndpoints)
 {
     return(SSOAuthenticationExtensions.UseSaml2SSOAuthentication(app, "/account/sso", assertionEndpoints));
 }
Пример #4
0
 public static IAppBuilder RegisterDiscoveryService(this IAppBuilder app, IDependencyResolver resolver)
 {
     return(SSOAuthenticationExtensions.RegisterDiscoveryService(app, resolver, typeof(DiscoveryService)));
 }
Пример #5
0
 public static IAppBuilder RegisterLogger(this IAppBuilder app, IDependencyResolver resolver)
 {
     SSOAuthenticationExtensions.RegisterLoggerFactory(app, resolver);
     resolver.RegisterFactory <ILogger>(() => app.CreateLogger <SSOOwinMiddleware>(), Lifetime.Transient);
     return(app);
 }