src/scitokens/scitokens.py
def test(self, token, authz, path=None):
        """
        Test whether a given token has the requested permission within the
        current enforcer context.
        """
        self._reset_state()
        self._test_access = True

        critical_claims = set(["scope"])
        # Check for the older "scp" attribute
        if 'scope' not in token and 'scp' in token:
            critical_claims = set(["scp"])

        if not path and (authz in self._authz_requiring_path):
            raise InvalidPathError("Enforcer provided with an empty path.")
        if path and not path.startswith("/"):
            raise InvalidPathError("Enforcer was given an invalid relative path to test; absolute path required.")

        self._test_path = path
        self._test_authz = authz
        self.last_failure = None
        try:
            self._validator.validate(token, critical_claims=critical_claims)
        except ValidationFailure as validation_failure:
            self.last_failure = str(validation_failure)
            return False
        return True

        Test whether a given token has the requested permission within the
        current enforcer context.
        
Test whether a given token has the requested permission within the
current enforcer context.
Test whether a given token has the requested permission within the current enforcer context .
def test(self, token, authz, path=None):
        self._reset_state()
        self._test_access = True
        critical_claims = set(["scope"])
        if 'scope' not in token and 'scp' in token:
            critical_claims = set(["scp"])
        if not path and (authz in self._authz_requiring_path):
            raise InvalidPathError("Enforcer provided with an empty path.")
        if path and not path.startswith("/"):
            raise InvalidPathError("Enforcer was given an invalid relative path to test; absolute path required.")
        self._test_path = path
        self._test_authz = authz
        self.last_failure = None
        try:
            self._validator.validate(token, critical_claims=critical_claims)
        except ValidationFailure as validation_failure:
            self.last_failure = str(validation_failure)
            return False
        return True
def test ( self , token , authz , path = None ) : self . _reset_state ( ) self . _test_access = True critical_claims = set ( [ "scope" ] ) if 'scope' not in token and 'scp' in token : critical_claims = set ( [ "scp" ] ) if not path and ( authz in self . _authz_requiring_path ) : raise InvalidPathError ( "Enforcer provided with an empty path." ) if path and not path . startswith ( "/" ) : raise InvalidPathError ( "Enforcer was given an invalid relative path to test; absolute path required." ) self . _test_path = path self . _test_authz = authz self . last_failure = None try : self . _validator . validate ( token , critical_claims = critical_claims ) except ValidationFailure as validation_failure : self . last_failure = str ( validation_failure ) return False return True
Test whether a given token has the requested permission within the
current enforcer context.
Test whether a given token has the requested permission within the current enforcer context .
"""
        Test whether a given token has the requested permission within the
        current enforcer context.
        """ # Check for the older "scp" attribute
self
token
authz
path