(self)
Validate the request.
Validate the request.
Validate the request .
def _validate(self):
        """Validate the request."""
        # Check for Bearer or Mac authorization
        if self.auth_type in ["bearer", "mac"]:
            self.attempted_validation = True
            if self.auth_type == "bearer":
                self._validate_bearer(self.auth_value)
            elif self.auth_type == "mac":
                self._validate_mac(self.auth_value)
            self.valid = True
        # Check for posted/paramaterized bearer token.
        elif self.bearer_token is not None:
            self.attempted_validation = True
            self._validate_bearer(self.bearer_token)
            self.valid = True
        else:
            raise InvalidRequest("Request authentication failed, no "
                "authentication credentials provided.")
        if self.authorized_scope is not None:
            token_scope = set([x.key for x in self.access_token.scope.all()])
            new_scope = self.authorized_scope - token_scope
            if len(new_scope) > 0:
                raise InsufficientScope(("Access token has insufficient "
                    "scope: %s") % ','.join(self.authorized_scope))
        now = TimestampGenerator()()
        if self.access_token.expire < now:
            raise InvalidToken("Token is expired")
def _validate ( self ) : # Check for Bearer or Mac authorization if self . auth_type in [ "bearer" , "mac" ] : self . attempted_validation = True if self . auth_type == "bearer" : self . _validate_bearer ( self . auth_value ) elif self . auth_type == "mac" : self . _validate_mac ( self . auth_value ) self . valid = True # Check for posted/paramaterized bearer token. elif self . bearer_token is not None : self . attempted_validation = True self . _validate_bearer ( self . bearer_token ) self . valid = True else : raise InvalidRequest ( "Request authentication failed, no " "authentication credentials provided." ) if self . authorized_scope is not None : token_scope = set ( [ x . key for x in self . access_token . scope . all ( ) ] ) new_scope = self . authorized_scope - token_scope if len ( new_scope ) > 0 : raise InsufficientScope ( ( "Access token has insufficient " "scope: %s" ) % ',' . join ( self . authorized_scope ) ) now = TimestampGenerator ( ) ( ) if self . access_token . expire < now : raise InvalidToken ( "Token is expired" )