private readonly AuthorizationValidatorInterface
$decorated,
private readonly Connection
$connection,
private readonly Configuration
$configuration ) { } /**
* @return ServerRequestInterface
*/
public function validateAuthorization(ServerRequestInterface
$request) { $request =
$this->decorated->
validateAuthorization($request);
$header =
$request->
getHeader('authorization'
);
$jwt =
trim(preg_replace('/^(?:\s+)?Bearer\s/', '',
$header[0
]) ?? ''
);
/** @var UnencryptedToken $token */
$token =
$this->configuration->
parser()->
parse($jwt);
if ($userId =
$request->
getAttribute(PlatformRequest::ATTRIBUTE_OAUTH_USER_ID
)) { $this->
validateAccessTokenIssuedAt($token->
claims()->
get('iat', 0
),
$userId);
}