src/scitokens/scitokens.py
def validate(self, token, critical_claims=None):
        """
        Validate the claims of a token.

        This will iterate through all claims in the given :class:`SciToken`
        and determine whether all claims a valid, given the current set of
        validators.

        If ``critical_claims`` is specified, then validation will fail if one
        or more claim in this list is not present in the token.

        This will throw an exception if the token is invalid and return ``True``
        if the token is valid.
        """
        if critical_claims:
            critical_claims = set(critical_claims)
        else:
            critical_claims = set()
        for claim, value in token.claims():
            if claim in critical_claims:
                critical_claims.remove(claim)
            validator_list = self._callbacks.setdefault(claim, [])
            if not validator_list:
                raise NoRegisteredValidator("No validator was registered to handle encountered claim '%s'" % claim)
            for validator in validator_list:
                if not validator(value):
                    raise ClaimInvalid("Validator rejected value of '%s' for claim '%s'" % (value, claim))
        if len(critical_claims):
            raise MissingClaims("Validation failed because the following claims are missing: %s" % \
                                ", ".join(critical_claims))
        return True

        Validate the claims of a token.

        This will iterate through all claims in the given :class:`SciToken`
        and determine whether all claims a valid, given the current set of
        validators.

        If ``critical_claims`` is specified, then validation will fail if one
        or more claim in this list is not present in the token.

        This will throw an exception if the token is invalid and return ``True``
        if the token is valid.
        
Validate the claims of a token.
This will iterate through all claims in the given :class:`SciToken`
and determine whether all claims a valid, given the current set of
validators.

If ``critical_claims`` is specified, then validation will fail if one
or more claim in this list is not present in the token.

This will throw an exception if the token is invalid and return ``True``
if the token is valid.
Validate the claims of a token . This will iterate through all claims in the given : class : ` SciToken ` and determine whether all claims a valid given the current set of validators . If ` ` critical_claims ` ` is specified then validation will fail if one or more claim in this list is not present in the token . This will throw an exception if the token is invalid and return ` ` True ` ` if the token is valid .
def validate(self, token, critical_claims=None):
        if critical_claims:
            critical_claims = set(critical_claims)
        else:
            critical_claims = set()
        for claim, value in token.claims():
            if claim in critical_claims:
                critical_claims.remove(claim)
            validator_list = self._callbacks.setdefault(claim, [])
            if not validator_list:
                raise NoRegisteredValidator("No validator was registered to handle encountered claim '%s'" % claim)
            for validator in validator_list:
                if not validator(value):
                    raise ClaimInvalid("Validator rejected value of '%s' for claim '%s'" % (value, claim))
        if len(critical_claims):
            raise MissingClaims("Validation failed because the following claims are missing: %s" % \
                                ", ".join(critical_claims))
        return True
def validate ( self , token , critical_claims = None ) : if critical_claims : critical_claims = set ( critical_claims ) else : critical_claims = set ( ) for claim , value in token . claims ( ) : if claim in critical_claims : critical_claims . remove ( claim ) validator_list = self . _callbacks . setdefault ( claim , [ ] ) if not validator_list : raise NoRegisteredValidator ( "No validator was registered to handle encountered claim '%s'" % claim ) for validator in validator_list : if not validator ( value ) : raise ClaimInvalid ( "Validator rejected value of '%s' for claim '%s'" % ( value , claim ) ) if len ( critical_claims ) : raise MissingClaims ( "Validation failed because the following claims are missing: %s" % ", " . join ( critical_claims ) ) return True
Validate the claims of a token.
Validate the claims of a token .
"""
        Validate the claims of a token.

        This will iterate through all claims in the given :class:`SciToken`
        and determine whether all claims a valid, given the current set of
        validators.

        If ``critical_claims`` is specified, then validation will fail if one
        or more claim in this list is not present in the token.

        This will throw an exception if the token is invalid and return ``True``
        if the token is valid.
        """
self
token
critical_claims