예제 #1
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());
        }