zenodo_accessrequests/tokens.py
def validate_token(cls, token, expected_data=None):
        """Validate a secret link token (non-expiring + expiring)."""
        for algorithm in SUPPORTED_DIGEST_ALGORITHMS:
            s = SecretLinkSerializer(algorithm_name=algorithm)
            st = TimedSecretLinkSerializer(algorithm_name=algorithm)

            try:
                for serializer in (s, st):
                    data = serializer.validate_token(
                        token, expected_data=expected_data)
                    if data:
                        return data
            except SignatureExpired:  # move to next algorithm
                raise
            except BadData:
                continue
def validate_token(cls, token, expected_data=None):
        """Validate a secret link token (non-expiring + expiring)."""
        for algorithm in SUPPORTED_DIGEST_ALGORITHMS:
            s = SecretLinkSerializer(algorithm_name=algorithm)
            st = TimedSecretLinkSerializer(algorithm_name=algorithm)

            try:
                for serializer in (s, st):
                    data = serializer.validate_token(
                        token, expected_data=expected_data)
                    if data:
                        return data
            except SignatureExpired:  # move to next algorithm
                raise
            except BadData:
                continue
def validate_token ( cls , token , expected_data = None ) : for algorithm in SUPPORTED_DIGEST_ALGORITHMS : s = SecretLinkSerializer ( algorithm_name = algorithm ) st = TimedSecretLinkSerializer ( algorithm_name = algorithm ) try : for serializer in ( s , st ) : data = serializer . validate_token ( token , expected_data = expected_data ) if data : return data except SignatureExpired : # move to next algorithm raise except BadData : continue
Validate a secret link token (non-expiring + expiring).
Validate a secret link token ( non - expiring + expiring ) .