Exemple #1
0
        public override IWebAuthResponse OnAuthorization(HttpContextBase httpContext, IEnumerable <AuthorizeGroupAttribute> groupAuthorizations)
        {
            IHttpRequestHelper requestHelper = GetRequestHelper(httpContext);
            bool HasGroupAuthorization       = groupAuthorizations.All(auth => auth.IsAuthorized(requestHelper.User));
            bool HasSiteAuthorization        = requestHelper.Application.ConfigurationService.FederatedIPAuthentication.Mode == FederatedAuth.FederatedIPAuthenticationMode.Consumer &&
                                               requestHelper.User.Sites.Any() ? requestHelper.User.Sites.Contains(requestHelper.Application.ConfigurationService.FederatedIPAuthentication.ApplicationId) : true;

            return(HasGroupAuthorization && HasSiteAuthorization?WebAuthResponse.Ok() : WebAuthResponse.Unauthorized());
        }
Exemple #2
0
        public override IWebAuthResponse OnAuthentication(HttpContextBase httpContext, bool authenticationRequired)
        {
            IHttpRequestHelper requestHelper = GetRequestHelper(httpContext);

            if (authenticationRequired)
            {
                bool HasSiteAuthorization = requestHelper.Application.ConfigurationService.FederatedIPAuthentication.Mode == FederatedAuth.FederatedIPAuthenticationMode.Consumer &&
                                            requestHelper.User.Sites.Any() ? requestHelper.User.Sites.Contains(requestHelper.Application.ConfigurationService.FederatedIPAuthentication.ApplicationId) : true;

                if (requestHelper.IsAuthenticatedUser && HasSiteAuthorization)
                {
                    requestHelper.HandleAuthenticatedRequest(UpdateUserData);
                    return(WebAuthResponse.Ok());
                }
                requestHelper.HandleForbiddenRequest();
                return(WebAuthResponse.Forbidden());
            }
            requestHelper.HandlePublicPageRequest();
            return(WebAuthResponse.Ok());
        }
Exemple #3
0
 public virtual IWebAuthResponse OnAuthorization(HttpContextBase httpContext, IEnumerable <AuthorizeGroupAttribute> groupAuthorizations) => WebAuthResponse.Ok();
Exemple #4
0
 public virtual IWebAuthResponse OnAuthentication(HttpContextBase httpContext, bool authenticationRequired) => WebAuthResponse.Ok();