def _validate_jwt_data(self, data, access_type):
        """
        Validates that the data for a jwt token is valid
        """
        MissingClaimError.require_condition(
            'jti' in data,
            'Token is missing jti claim',
        )
        BlacklistedError.require_condition(
            not self.is_blacklisted(data['jti']),
            'Token has a blacklisted jti',
        )
        MissingClaimError.require_condition(
            'id' in data,
            'Token is missing id field',
        )
        MissingClaimError.require_condition(
            'exp' in data,
            'Token is missing exp claim',
        )
        MissingClaimError.require_condition(
            'rf_exp' in data,
            'Token is missing rf_exp claim',
        )
        moment = pendulum.now('UTC').int_timestamp
        if access_type == AccessType.access:
            ExpiredAccessError.require_condition(
                moment <= data['exp'],
                'access permission has expired',
            )
        elif access_type == AccessType.refresh:
            EarlyRefreshError.require_condition(
                moment > data['exp'],
                'access permission for token has not expired. may not refresh',
            )
            ExpiredRefreshError.require_condition(
                moment <= data['rf_exp'],
                'refresh permission for token has expired',
            )
def _validate_jwt_data ( self , data , access_type ) : MissingClaimError . require_condition ( 'jti' in data , 'Token is missing jti claim' , ) BlacklistedError . require_condition ( not self . is_blacklisted ( data [ 'jti' ] ) , 'Token has a blacklisted jti' , ) MissingClaimError . require_condition ( 'id' in data , 'Token is missing id field' , ) MissingClaimError . require_condition ( 'exp' in data , 'Token is missing exp claim' , ) MissingClaimError . require_condition ( 'rf_exp' in data , 'Token is missing rf_exp claim' , ) moment = pendulum . now ( 'UTC' ) . int_timestamp if access_type == AccessType . access : ExpiredAccessError . require_condition ( moment <= data [ 'exp' ] , 'access permission has expired' , ) elif access_type == AccessType . refresh : EarlyRefreshError . require_condition ( moment > data [ 'exp' ] , 'access permission for token has not expired. may not refresh' , ) ExpiredRefreshError . require_condition ( moment <= data [ 'rf_exp' ] , 'refresh permission for token has expired' , )
Validates that the data for a jwt token is valid