flask_cognito.py
def _cognito_auth_required():
    """Does the actual work of verifying the Cognito JWT data in the current request.
    This is done automatically for you by `cognito_jwt_required()` but you could call it manually.
    Doing so would be useful in the context of optional JWT access in your APIs.
    """
    token = _cog.get_token()

    if token is None:
        auth_header_name = _cog.jwt_header_name
        auth_header_prefix = _cog.jwt_header_prefix
        raise CognitoAuthError('Authorization Required',
                               f'Request does not contain a well-formed access token in the "{auth_header_name}" header beginning with "{auth_header_prefix}"')

    try:
        # check if token is signed by userpool
        payload = _cog.decode_token(token=token)
    except CognitoJWTException as e:
        log.info('Authentication Failure', exc_info=e)
        raise CognitoAuthError('Invalid Cognito Authentication Token', str(e)) from e

    _request_ctx_stack.top.cogauth_cognito_jwt = payload
    _request_ctx_stack.top.cogauth_current_user = _cog.get_user(payload)
Does the actual work of verifying the Cognito JWT data in the current request.
    This is done automatically for you by `cognito_jwt_required()` but you could call it manually.
    Doing so would be useful in the context of optional JWT access in your APIs.
    
Does the actual work of verifying the Cognito JWT data in the current request.
This is done automatically for you by `cognito_jwt_required()` but you could call it manually.
Doing so would be useful in the context of optional JWT access in your APIs.
Does the actual work of verifying the Cognito JWT data in the current request . This is done automatically for you by ` cognito_jwt_required () ` but you could call it manually . Doing so would be useful in the context of optional JWT access in your APIs .
def _cognito_auth_required():
    token = _cog.get_token()
    if token is None:
        auth_header_name = _cog.jwt_header_name
        auth_header_prefix = _cog.jwt_header_prefix
        raise CognitoAuthError('Authorization Required',
                               f'Request does not contain a well-formed access token in the "{auth_header_name}" header beginning with "{auth_header_prefix}"')
    try:
        payload = _cog.decode_token(token=token)
    except CognitoJWTException as e:
        log.info('Authentication Failure', exc_info=e)
        raise CognitoAuthError('Invalid Cognito Authentication Token', str(e)) from e
    _request_ctx_stack.top.cogauth_cognito_jwt = payload
    _request_ctx_stack.top.cogauth_current_user = _cog.get_user(payload)
def _cognito_auth_required ( ) : token = _cog . get_token ( ) if token is None : auth_header_name = _cog . jwt_header_name auth_header_prefix = _cog . jwt_header_prefix raise CognitoAuthError ( 'Authorization Required' , f'Request does not contain a well-formed access token in the "{auth_header_name}" header beginning with "{auth_header_prefix}"' ) try : payload = _cog . decode_token ( token = token ) except CognitoJWTException as e : log . info ( 'Authentication Failure' , exc_info = e ) raise CognitoAuthError ( 'Invalid Cognito Authentication Token' , str ( e ) ) from e _request_ctx_stack . top . cogauth_cognito_jwt = payload _request_ctx_stack . top . cogauth_current_user = _cog . get_user ( payload )
Does the actual work of verifying the Cognito JWT data in the current request.
Does the actual work of verifying the Cognito JWT data in the current request .
"""Does the actual work of verifying the Cognito JWT data in the current request.
    This is done automatically for you by `cognito_jwt_required()` but you could call it manually.
    Doing so would be useful in the context of optional JWT access in your APIs.
    """ # check if token is signed by userpool