Esempio n. 1
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (_requiredAccessLevel == StoreAccessLevel.None)
            {
                return(true);
            }
            SignatureType sigType;
            string        accountId;
            string        signature;

            if (RestClientHelper.GetAuthorizationInfo(httpContext.Request, out sigType, out accountId, out signature))
            {
                if (ValidateDate(httpContext.Request))
                {
                    var accessAccount = GetAccessAccount(accountId);
                    if (accessAccount != null)
                    {
                        httpContext.Request.RequestContext.RouteData.Values.Add("_accessAccount", accessAccount);
                        if (ValidateSignature(httpContext.Request, accessAccount, sigType, signature) &&
                            ValidateAccessPrivileges(httpContext.Request, accessAccount))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }