diff --git a/app/Http/Controllers/Api/OAuth2/OAuth2DisqusSSOApiController.php b/app/Http/Controllers/Api/OAuth2/OAuth2DisqusSSOApiController.php index 9ce167cd..6688789b 100644 --- a/app/Http/Controllers/Api/OAuth2/OAuth2DisqusSSOApiController.php +++ b/app/Http/Controllers/Api/OAuth2/OAuth2DisqusSSOApiController.php @@ -17,6 +17,9 @@ use models\exceptions\ValidationException; use OAuth2\IResourceServerContext; use Utils\Services\ILogService; +use App\libs\OAuth2\IUserScopes; +use OpenApi\Attributes as OA; +use Symfony\Component\HttpFoundation\Response as HttpResponse; /** * Class OAuth2DisqusSSOApiController * @package App\Http\Controllers\Api\OAuth2 @@ -40,6 +43,41 @@ public function __construct $this->service = $service; } + #[OA\Get( + path: '/api/v1/sso/disqus/{forum_slug}/profile', + operationId: 'getDisqusUserProfile', + summary: 'Get Disqus user profile for a forum', + security: [['OAuth2DisqusSSOSecurity' => [IUserScopes::SSO]]], + tags: ['Disqus 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/DisqusUserProfileSerialized') + ), + 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' + ), + ] + )] /** * @param string $forum_slug * @return \Illuminate\Http\JsonResponse|mixed diff --git a/app/Swagger/Models/DisqusUserProfileSerializedSchema.php b/app/Swagger/Models/DisqusUserProfileSerializedSchema.php new file mode 100644 index 00000000..27b4f669 --- /dev/null +++ b/app/Swagger/Models/DisqusUserProfileSerializedSchema.php @@ -0,0 +1,18 @@ + 'Single Sign-On access'] + ), + ] +)] +class OAuth2DisqusSSOSecuritySchema +{ +} \ No newline at end of file