def METHOD_NAME(view):
    def view_wrapper(request: HttpRequest, *args, **kwargs):
        if request.method == "OPTIONS":
            return view(request, *args, **kwargs)
        try:
            access_token = extract_access_token(request)
            if not access_token:
                LOGGER.debug("No token passed")
                raise BearerTokenError("invalid_token")
            token = AccessToken.objects.filter(token=access_token).first()
            if not token:
                LOGGER.debug("Token does not exist", access_token=access_token)
                raise BearerTokenError("invalid_token")
            if token.is_expired:
                LOGGER.debug("Token has expired", access_token=access_token)
                raise BearerTokenError("invalid_token")
            if token.revoked:
                LOGGER.warning("Revoked token was used", access_token=access_token)
                Event.new(
                    action=EventAction.SUSPICIOUS_REQUEST,
                    message="Revoked access token was used",
                    token=token,
                    provider=token.provider,
                ).from_http(request, user=token.user)
                raise BearerTokenError("invalid_token")
            if not set(scopes).issubset(set(token.scope)):
                LOGGER.warning(
                    "Scope mismatch.",
                    required=set(scopes),
                    token_has=set(token.scope),
                )
                raise BearerTokenError("insufficient_scope")
        except BearerTokenError as error:
            response = HttpResponse(status=error.status)
            response[
                "WWW-Authenticate"
            ] = f'error="{error.code}", error_description="{error.description}"'
            return response
        kwargs["token"] = token
        CTX_AUTH_VIA.set("oauth_token")
        response = view(request, *args, **kwargs)
        setattr(response, "ak_context", {})
        response.ak_context[KEY_USER] = token.user.username
        return response
    return view_wrapper