From c32ed9b8853527eee6d0613ad4a05b8a5426cfc3 Mon Sep 17 00:00:00 2001 From: matiasperrone-exo Date: Wed, 11 Feb 2026 22:28:38 +0000 Subject: [PATCH 1/2] feat: Add OpenAPI documentation annotations for OAuth2StreamChatSSOApiController Signed-off-by: matiasperrone-exo --- .../OAuth2StreamChatSSOApiController.php | 38 +++++++++++++++++++ .../Models/StreamChatUserProfileSchema.php | 22 +++++++++++ ...reamChatSSOApiControllerSecuritySchema.php | 23 +++++++++++ 3 files changed, 83 insertions(+) create mode 100644 app/Swagger/Models/StreamChatUserProfileSchema.php create mode 100644 app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php diff --git a/app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php b/app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php index 9eaf8b8d..4777d0ac 100644 --- a/app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php +++ b/app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php @@ -11,11 +11,14 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ +use App\libs\OAuth2\IUserScopes; use App\Services\Auth\IStreamChatSSOService; use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; use models\exceptions\ValidationException; use OAuth2\IResourceServerContext; +use OpenApi\Attributes as OA; +use Symfony\Component\HttpFoundation\Response as HttpResponse; use Utils\Services\ILogService; /** * Class OAuth2StreamChatSSOApiController @@ -44,6 +47,41 @@ public function __construct * @param string $forum_slug * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: '/api/v1/sso/stream-chat/{forum_slug}/profile', + operationId: 'getStreamChatUserProfile', + summary: 'Get Stream Chat user profile for a forum', + security: [['OAuth2StreamChatSSOSecurity' => [IUserScopes::SSO]]], + tags: ['Stream Chat SSO'], + parameters: [ + new OA\Parameter( + name: 'forum_slug', + description: 'Forum slug', + in: 'path', + required: true, + schema: new OA\Schema(type: 'string') + ), + ], + responses: [ + new OA\Response( + response: HttpResponse::HTTP_OK, + description: 'OK', + content: new OA\JsonContent(ref: '#/components/schemas/StreamChatUserProfile') + ), + new OA\Response( + response: HttpResponse::HTTP_NOT_FOUND, + description: 'Not Found' + ), + new OA\Response( + response: HttpResponse::HTTP_PRECONDITION_FAILED, + description: 'Validation Error' + ), + new OA\Response( + response: HttpResponse::HTTP_INTERNAL_SERVER_ERROR, + description: 'Server Error' + ), + ] + )] public function getUserProfile(string $forum_slug){ try{ $profile = $this->service->getUserProfile($forum_slug); diff --git a/app/Swagger/Models/StreamChatUserProfileSchema.php b/app/Swagger/Models/StreamChatUserProfileSchema.php new file mode 100644 index 00000000..df855aa8 --- /dev/null +++ b/app/Swagger/Models/StreamChatUserProfileSchema.php @@ -0,0 +1,22 @@ + 'Single Sign-On access'] + ), + ] +)] +class OAuth2StreamChatSSOApiControllerSecuritySchema +{ +} From 9935b599abf9855f9f56daa33f2660d15fbaac66 Mon Sep 17 00:00:00 2001 From: matiasperrone-exo Date: Thu, 12 Feb 2026 19:22:05 +0000 Subject: [PATCH 2/2] fix: Update OAuth2GroupsSecurity security scheme to use constants for URLs Signed-off-by: matiasperrone-exo --- .../OAuth2StreamChatSSOApiControllerSecuritySchema.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php b/app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php index 2af222a3..75a6596c 100644 --- a/app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php +++ b/app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php @@ -12,12 +12,12 @@ flows: [ new OA\Flow( flow: 'authorizationCode', - authorizationUrl: '/oauth2/auth', - tokenUrl: '/oauth2/token', + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, scopes: [IUserScopes::SSO => 'Single Sign-On access'] ), ] )] class OAuth2StreamChatSSOApiControllerSecuritySchema { -} +} \ No newline at end of file