public BeanMiddleware(OwinMiddleware next, IAppBuilder app, BeanMiddlewareOptions options)
        {
            if (null == next) throw new ArgumentNullException("next");
            if (null == app) throw new ArgumentNullException("app");
            if (null == options) throw new ArgumentNullException("options");
            _next = next;
            _app = app;
            _options = options;

            //app.Use<WsFederationAuthenticationMiddleware>(app, options);
            _innerMiddleware = new WsFederationAuthenticationMiddleware(next, app, options);
        }
        public static void UseBeanMiddleware(this IAppBuilder app, BeanMiddlewareOptions options = null)
        {
            if (options == null) options = new BeanMiddlewareOptions();

            app.Map("/signout", map => map.Run(ctx =>
            {
                //ctx.Authentication.SignOut(new[] { CookieAuthenticationDefaults.AuthenticationType, AuthenticationTypes.Federation });
                ctx.Response.Cookies.Delete(BeanCookieName);
                ctx.Response.Redirect(options.SignoutUrl);
                return ctx.Response.WriteAsync("Signing out... ");
            }));
            
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions()
                {
                    CookieName = BeanCookieName
                });
            app.Use<BeanMiddleware>(app, options);
        }
Пример #3
0
        public BeanMiddleware(OwinMiddleware next, IAppBuilder app, BeanMiddlewareOptions options)
        {
            if (null == next)
            {
                throw new ArgumentNullException("next");
            }
            if (null == app)
            {
                throw new ArgumentNullException("app");
            }
            if (null == options)
            {
                throw new ArgumentNullException("options");
            }
            _next    = next;
            _app     = app;
            _options = options;

            //app.Use<WsFederationAuthenticationMiddleware>(app, options);
            _innerMiddleware = new WsFederationAuthenticationMiddleware(next, app, options);
        }