public function authenticate()
    {
        $request = ServerRequest::fromGlobals();
        try {
            return $this->resourceServer->validateAuthenticatedRequest($request);
        } catch (OAuthServerException $exception) {
            $message = $exception->getMessage();
            if ($hint = $exception->getHint()) {
                $message .= ' (' . $hint . ')';
            }
            throw Exception::clientException($message, $exception->getHttpStatusCode(), $exception->getErrorType(), $exception->getHttpStatusCode());
        } catch (\Exception $exception) {
            throw Exception::serverException($exception->getMessage(), $exception->getCode());
        }
    }