original_docstring:  Decorator that will check that event.requestContext.authorizer.scopes has the given
      scopes. This decorator assumes that you have an upstream authorizer putting the scopes from the
      access_token into the event.requestContext.authorizer.scopes. This is a reasonable assumption
      if you are using a custom authorizer, which we are!
  
      Args:
          scope_list (List): List of required access_token scopes. Each item must be castable to string.
  
      Returns:
          handler (func): a lambda handler function that is namespace aware
      
docstring: Decorator that will check that event.requestContext.authorizer.scopes has the given
  scopes. This decorator assumes that you have an upstream authorizer putting the scopes from the
  access_token into the event.requestContext.authorizer.scopes. This is a reasonable assumption
  if you are using a custom authorizer, which we are!
docstring_tokens: Decorator that will check that event . requestContext . authorizer . scopes has the given scopes . This decorator assumes that you have an upstream authorizer putting the scopes from the access_token into the event . requestContext . authorizer . scopes . This is a reasonable assumption if you are using a custom authorizer which we are!
code: def scopes(*scope_list):
      """ Decorator that will check that event.requestContext.authorizer.scopes has the given
      scopes. This decorator assumes that you have an upstream authorizer putting the scopes from the
      access_token into the event.requestContext.authorizer.scopes. This is a reasonable assumption
      if you are using a custom authorizer, which we are!
  
      Args:
          scope_list (List): List of required access_token scopes. Each item must be castable to string.
  
      Returns:
          handler (func): a lambda handler function that is namespace aware
      """
      try:
          string_scope_list = [str(s) for s in scope_list]
      except Exception as err:
          logger.exception(err)
          raise TypeError('All scopes must be castable to string.')
  
      def scopes_handler(handler):
          def handler_wrapper(event, context, **kwargs):
              token_scopes = utils.deep_get(event, 'requestContext', 'authorizer', 'scopes')
  
              if not token_scopes:
                  return {'statusCode': 500, 'body': 'Invalid token scopes: missing!'}
  
              if not all((s in token_scopes for s in string_scope_list)):
                  logger.warning(f'There is a required scope [{scope_list}] missing from token scopes [{token_scopes}].')
                  return {'statusCode': 403, 'body': 'access_token has insufficient access.'}
  
              return handler(event, context, **kwargs)
  
          return handler_wrapper
  
      return scopes_handler
code_tokens: def scopes ( * scope_list ) : try : string_scope_list = [ str ( s ) for s in scope_list ] except Exception as err : logger . exception ( err ) raise TypeError ( 'All scopes must be castable to string.' ) def scopes_handler ( handler ) : def handler_wrapper ( event , context , ** kwargs ) : token_scopes = utils . deep_get ( event , 'requestContext' , 'authorizer' , 'scopes' ) if not token_scopes : return { 'statusCode' : 500 , 'body' : 'Invalid token scopes: missing!' } if not all ( ( s in token_scopes for s in string_scope_list ) ) : logger . warning ( f'There is a required scope [{scope_list}] missing from token scopes [{token_scopes}].' ) return { 'statusCode' : 403 , 'body' : 'access_token has insufficient access.' } return handler ( event , context , ** kwargs ) return handler_wrapper return scopes_handler
short_docstring: Decorator that will check that event.requestContext.authorizer.scopes has the given
  scopes.
short_docstring_tokens: Decorator that will check that event . requestContext . authorizer . scopes has the given scopes .
comment: """ Decorator that will check that event.requestContext.authorizer.scopes has the given
      scopes. This decorator assumes that you have an upstream authorizer putting the scopes from the
      access_token into the event.requestContext.authorizer.scopes. This is a reasonable assumption
      if you are using a custom authorizer, which we are!
  
      Args:
          scope_list (List): List of required access_token scopes. Each item must be castable to string.
  
      Returns:
          handler (func): a lambda handler function that is namespace aware
      """