def _maybe_set_current_user_vars(method, api_info=None, request=None):
if _is_auth_info_available():<EOL><INDENT>return<EOL><DEDENT>os.environ[_ENV_AUTH_EMAIL] = '<STR_LIT>'<EOL>os.environ[_ENV_AUTH_DOMAIN] = '<STR_LIT>'<EOL>try:<EOL><INDENT>api_info = api_info or method.__self__.api_info<EOL><DEDENT>except AttributeError:<EOL><INDENT>_logger.warning('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>method.__name__)<EOL>scopes = method.method_info.scopes<EOL>audiences = method.method_info.audiences<EOL>allowed_client_ids = method.method_info.allowed_client_ids<EOL><DEDENT>else:<EOL><INDENT>scopes = (method.method_info.scopes<EOL>if method.method_info.scopes is not None<EOL>else api_info.scopes)<EOL>audiences = (method.method_info.audiences<EOL>if method.method_info.audiences is not None<EOL>else api_info.audiences)<EOL>allowed_client_ids = (method.method_info.allowed_client_ids<EOL>if method.method_info.allowed_client_ids is not None<EOL>else api_info.allowed_client_ids)<EOL><DEDENT>if not scopes and not audiences and not allowed_client_ids:<EOL><INDENT>return<EOL><DEDENT>token = _get_token(request)<EOL>if not token:<EOL><INDENT>return None<EOL><DEDENT>if allowed_client_ids and _is_local_dev():<EOL><INDENT>allowed_client_ids = (constants.API_EXPLORER_CLIENT_ID,) + tuple(allowed_client_ids)<EOL><DEDENT>if ((scopes == [_EMAIL_SCOPE] or scopes == (_EMAIL_SCOPE,)) and<EOL>allowed_client_ids):<EOL><INDENT>_logger.debug('<STR_LIT>')<EOL>issuers = api_info.issuers<EOL>if issuers is None:<EOL><INDENT>issuers = _DEFAULT_GOOGLE_ISSUER<EOL><DEDENT>elif '<STR_LIT>' not in issuers:<EOL><INDENT>issuers.update(_DEFAULT_GOOGLE_ISSUER)<EOL><DEDENT>time_now = int(time.time())<EOL>user = _get_id_token_user(token, issuers, audiences, allowed_client_ids,<EOL>time_now, memcache)<EOL>if user:<EOL><INDENT>os.environ[_ENV_AUTH_EMAIL] = user.email()<EOL>os.environ[_ENV_AUTH_DOMAIN] = user.auth_domain()<EOL>return<EOL><DEDENT><DEDENT>if scopes:<EOL><INDENT>_logger.debug('<STR_LIT>')<EOL>if _is_local_dev():<EOL><INDENT>_set_bearer_user_vars_local(token, allowed_client_ids, scopes)<EOL><DEDENT>else:<EOL><INDENT>_set_bearer_user_vars(allowed_client_ids, scopes)<EOL><DEDENT><DEDENT>
Get user information from the id_token or oauth token in the request.

    Used internally by Endpoints to set up environment variables for user
    authentication.

    Args:
      method: The class method that's handling this request.  This method
        should be annotated with @endpoints.method.
      api_info: An api_config._ApiInfo instance. Optional. If None, will attempt
        to parse api_info from the implicit instance of the method.
      request: The current request, or None.