From f1511d93e21c2b4b64354662e45a0df85f0bc88a Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 29 Apr 2022 17:47:36 +0000 Subject: [PATCH] ci: commit oat-sa/environment-management# --- src/Http/AuthorizationDetailsHeaderMarker.php | 19 +++++++++++++++---- .../AuthorizationDetailsMarkerInterface.php | 12 +++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Http/AuthorizationDetailsHeaderMarker.php b/src/Http/AuthorizationDetailsHeaderMarker.php index 7ed9f00..fe41cf9 100644 --- a/src/Http/AuthorizationDetailsHeaderMarker.php +++ b/src/Http/AuthorizationDetailsHeaderMarker.php @@ -28,9 +28,20 @@ final class AuthorizationDetailsHeaderMarker implements AuthorizationDetailsMark { private const DEFAULT_HEADER_NAME = 'X-OAT-WITH-AUTH-DETAILS'; - public function withAuthDetails(ResponseInterface $response, string $clientId, string $refreshTokenId): ResponseInterface - { - $withAuthDetails = array('clientId' => $clientId, 'refreshTokenId' => $refreshTokenId); - return $response->withHeader(self::DEFAULT_HEADER_NAME, json_encode($withAuthDetails)); + public function withAuthDetails( + ResponseInterface $response, + string $clientId, + string $refreshTokenId, + string $userIdentifier = null, + string $userRole = null, + string $mode = self::MODE_COOKIE, + ): ResponseInterface { + return $response->withHeader(self::DEFAULT_HEADER_NAME, json_encode([ + 'clientId' => $clientId, + 'refreshTokenId' => $refreshTokenId, + 'userIdentifier' => $userIdentifier, + 'userRole' => $userRole, + 'mode' => $mode, + ])); } } diff --git a/src/Http/AuthorizationDetailsMarkerInterface.php b/src/Http/AuthorizationDetailsMarkerInterface.php index d0010c6..ec19dbf 100644 --- a/src/Http/AuthorizationDetailsMarkerInterface.php +++ b/src/Http/AuthorizationDetailsMarkerInterface.php @@ -26,5 +26,15 @@ interface AuthorizationDetailsMarkerInterface { - public function withAuthDetails(ResponseInterface $response, string $clientId, string $refreshTokenId): ResponseInterface; + public const MODE_COOKIE = 'cookie'; + public const MODE_QUERY_PARAMETER = 'queryParameter'; + + public function withAuthDetails( + ResponseInterface $response, + string $clientId, + string $refreshTokenId, + string $userIdentifier = null, + string $userRole = null, + string $mode = self::MODE_COOKIE, + ): ResponseInterface; }