Esempio n. 1
0
        private static AuthorizationResult AuthorizeSourceIp(IPAddressRange signedIP, RequestContext requestContext)
        {
            IPAddressRange      pAddressRange;
            AuthorizationResult authorizationResult = new AuthorizationResult(true, AuthorizationFailureReason.NotApplicable);

            if (signedIP == null || IPAddressRange.IsContainedInRange(requestContext.ClientIP.Address, signedIP, out pAddressRange))
            {
                return(authorizationResult);
            }
            authorizationResult.FailureReason = AuthorizationFailureReason.SourceIPMismatch;
            authorizationResult.Authorized    = false;
            return(authorizationResult);
        }