public static function token(Request $request)
    {
        $authorization = $request->getHeader('Authorization');

        if (!isset($authorization[0])) {
            throw new HeaderWithoutAuthorizationException('The request does not contain the Authorization header');
        }

        $token = preg_replace('/^\w+\s/', '', $authorization[0]);

        return Authenticator::decodeToken($token);
    }