|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\Swagger\schemas; |
| 4 | + |
| 5 | +use OpenApi\Attributes as OA; |
| 6 | + |
| 7 | +#[OA\Schema( |
| 8 | + schema: 'OAuth2TokenResponse', |
| 9 | + title: 'OAuth2 Token Response', |
| 10 | + description: 'Successful token response per RFC 6749 §5.1', |
| 11 | + type: 'object', |
| 12 | + properties: [ |
| 13 | + new OA\Property(property: 'access_token', type: 'string', description: 'The access token issued by the authorization server'), |
| 14 | + new OA\Property(property: 'token_type', type: 'string', description: 'The type of the token (typically Bearer)', example: 'Bearer'), |
| 15 | + new OA\Property(property: 'expires_in', type: 'integer', description: 'Lifetime of the access token in seconds', example: 3600), |
| 16 | + new OA\Property(property: 'refresh_token', type: 'string', description: 'Refresh token (only if access_type=offline)', nullable: true), |
| 17 | + new OA\Property(property: 'scope', type: 'string', description: 'Space-delimited list of granted scopes'), |
| 18 | + new OA\Property(property: 'id_token', type: 'string', description: 'ID token JWT (only for OpenID Connect flows with openid scope)', nullable: true), |
| 19 | + ] |
| 20 | +)] |
| 21 | +class OAuth2TokenResponseSchema |
| 22 | +{ |
| 23 | +} |
| 24 | + |
| 25 | +#[OA\Schema( |
| 26 | + schema: 'OAuth2ErrorResponse', |
| 27 | + title: 'OAuth2 Error Response', |
| 28 | + description: 'Error response per RFC 6749 §5.2', |
| 29 | + type: 'object', |
| 30 | + required: ['error'], |
| 31 | + properties: [ |
| 32 | + new OA\Property(property: 'error', type: 'string', description: 'Error code', example: 'invalid_request'), |
| 33 | + new OA\Property(property: 'error_description', type: 'string', description: 'Human-readable error description'), |
| 34 | + ] |
| 35 | +)] |
| 36 | +class OAuth2ErrorResponseSchema |
| 37 | +{ |
| 38 | +} |
| 39 | + |
| 40 | +#[OA\Schema( |
| 41 | + schema: 'OAuth2IntrospectionResponse', |
| 42 | + title: 'OAuth2 Token Introspection Response', |
| 43 | + description: 'Token introspection response per RFC 7662', |
| 44 | + type: 'object', |
| 45 | + properties: [ |
| 46 | + new OA\Property(property: 'active', type: 'boolean', description: 'Whether the token is active'), |
| 47 | + new OA\Property(property: 'access_token', type: 'string', description: 'The access token value'), |
| 48 | + new OA\Property(property: 'client_id', type: 'string', description: 'Client identifier'), |
| 49 | + new OA\Property(property: 'application_type', type: 'string', description: 'Client application type', enum: ['WEB', 'NATIVE', 'JS']), |
| 50 | + new OA\Property(property: 'token_type', type: 'string', description: 'Token type', example: 'Bearer'), |
| 51 | + new OA\Property(property: 'scope', type: 'string', description: 'Space-delimited scopes'), |
| 52 | + new OA\Property(property: 'audience', type: 'string', description: 'Token audience'), |
| 53 | + new OA\Property(property: 'expires_in', type: 'integer', description: 'Remaining lifetime in seconds'), |
| 54 | + new OA\Property(property: 'user_id', type: 'integer', description: 'Resource owner user ID', nullable: true), |
| 55 | + new OA\Property(property: 'user_identifier', type: 'string', description: 'Resource owner identifier', nullable: true), |
| 56 | + new OA\Property(property: 'user_email', type: 'string', description: 'Resource owner email', nullable: true), |
| 57 | + new OA\Property(property: 'user_first_name', type: 'string', description: 'Resource owner first name', nullable: true), |
| 58 | + new OA\Property(property: 'user_last_name', type: 'string', description: 'Resource owner last name', nullable: true), |
| 59 | + new OA\Property(property: 'user_pic', type: 'string', format: 'uri', description: 'Resource owner profile picture URL', nullable: true), |
| 60 | + new OA\Property( |
| 61 | + property: 'user_groups', |
| 62 | + type: 'array', |
| 63 | + description: 'Resource owner group memberships', |
| 64 | + items: new OA\Items( |
| 65 | + type: 'object', |
| 66 | + properties: [ |
| 67 | + new OA\Property(property: 'id', type: 'integer'), |
| 68 | + new OA\Property(property: 'title', type: 'string'), |
| 69 | + new OA\Property(property: 'description', type: 'string'), |
| 70 | + ] |
| 71 | + ), |
| 72 | + nullable: true |
| 73 | + ), |
| 74 | + new OA\Property(property: 'user_email_verified', type: 'boolean', description: 'Whether the user email is verified', nullable: true), |
| 75 | + new OA\Property(property: 'user_language', type: 'string', description: 'User preferred language', nullable: true), |
| 76 | + new OA\Property(property: 'user_country', type: 'string', description: 'User country', nullable: true), |
| 77 | + new OA\Property(property: 'allowed_return_uris', type: 'string', description: 'Space-delimited allowed return URIs'), |
| 78 | + new OA\Property(property: 'allowed_origins', type: 'string', description: 'Space-delimited allowed origins'), |
| 79 | + ] |
| 80 | +)] |
| 81 | +class OAuth2IntrospectionResponseSchema |
| 82 | +{ |
| 83 | +} |
| 84 | + |
| 85 | +#[OA\Schema( |
| 86 | + schema: 'JWKSResponse', |
| 87 | + title: 'JSON Web Key Set', |
| 88 | + description: 'JWK Set document per RFC 7517', |
| 89 | + type: 'object', |
| 90 | + properties: [ |
| 91 | + new OA\Property( |
| 92 | + property: 'keys', |
| 93 | + type: 'array', |
| 94 | + description: 'Array of JSON Web Keys', |
| 95 | + items: new OA\Items( |
| 96 | + type: 'object', |
| 97 | + properties: [ |
| 98 | + new OA\Property(property: 'kty', type: 'string', description: 'Key type', example: 'RSA'), |
| 99 | + new OA\Property(property: 'kid', type: 'string', description: 'Key ID'), |
| 100 | + new OA\Property(property: 'use', type: 'string', description: 'Key usage', example: 'sig'), |
| 101 | + new OA\Property(property: 'alg', type: 'string', description: 'Algorithm', example: 'RS256'), |
| 102 | + new OA\Property(property: 'n', type: 'string', description: 'RSA modulus (Base64urlUInt-encoded)'), |
| 103 | + new OA\Property(property: 'e', type: 'string', description: 'RSA exponent (Base64urlUInt-encoded)', example: 'AQAB'), |
| 104 | + ] |
| 105 | + ) |
| 106 | + ), |
| 107 | + ] |
| 108 | +)] |
| 109 | +class JWKSResponseSchema |
| 110 | +{ |
| 111 | +} |
| 112 | + |
| 113 | +#[OA\Schema( |
| 114 | + schema: 'OpenIDDiscoveryResponse', |
| 115 | + title: 'OpenID Connect Discovery Document', |
| 116 | + description: 'OpenID Provider Configuration per OpenID Connect Discovery 1.0', |
| 117 | + type: 'object', |
| 118 | + properties: [ |
| 119 | + new OA\Property(property: 'issuer', type: 'string', format: 'uri', description: 'Issuer identifier URL'), |
| 120 | + new OA\Property(property: 'authorization_endpoint', type: 'string', format: 'uri', description: 'Authorization endpoint URL'), |
| 121 | + new OA\Property(property: 'token_endpoint', type: 'string', format: 'uri', description: 'Token endpoint URL'), |
| 122 | + new OA\Property(property: 'userinfo_endpoint', type: 'string', format: 'uri', description: 'UserInfo endpoint URL'), |
| 123 | + new OA\Property(property: 'revocation_endpoint', type: 'string', format: 'uri', description: 'Token revocation endpoint URL'), |
| 124 | + new OA\Property(property: 'introspection_endpoint', type: 'string', format: 'uri', description: 'Token introspection endpoint URL'), |
| 125 | + new OA\Property(property: 'jwks_uri', type: 'string', format: 'uri', description: 'JSON Web Key Set URL'), |
| 126 | + new OA\Property( |
| 127 | + property: 'scopes_supported', |
| 128 | + type: 'array', |
| 129 | + description: 'Supported OAuth2 scopes', |
| 130 | + items: new OA\Items(type: 'string') |
| 131 | + ), |
| 132 | + new OA\Property( |
| 133 | + property: 'response_types_supported', |
| 134 | + type: 'array', |
| 135 | + description: 'Supported response types', |
| 136 | + items: new OA\Items(type: 'string') |
| 137 | + ), |
| 138 | + new OA\Property( |
| 139 | + property: 'response_modes_supported', |
| 140 | + type: 'array', |
| 141 | + description: 'Supported response modes', |
| 142 | + items: new OA\Items(type: 'string') |
| 143 | + ), |
| 144 | + new OA\Property( |
| 145 | + property: 'grant_types_supported', |
| 146 | + type: 'array', |
| 147 | + description: 'Supported grant types', |
| 148 | + items: new OA\Items(type: 'string') |
| 149 | + ), |
| 150 | + new OA\Property( |
| 151 | + property: 'subject_types_supported', |
| 152 | + type: 'array', |
| 153 | + description: 'Supported subject types', |
| 154 | + items: new OA\Items(type: 'string') |
| 155 | + ), |
| 156 | + new OA\Property( |
| 157 | + property: 'id_token_signing_alg_values_supported', |
| 158 | + type: 'array', |
| 159 | + description: 'Supported ID token signing algorithms', |
| 160 | + items: new OA\Items(type: 'string') |
| 161 | + ), |
| 162 | + new OA\Property( |
| 163 | + property: 'code_challenge_methods_supported', |
| 164 | + type: 'array', |
| 165 | + description: 'Supported PKCE code challenge methods', |
| 166 | + items: new OA\Items(type: 'string') |
| 167 | + ), |
| 168 | + ] |
| 169 | +)] |
| 170 | +class OpenIDDiscoveryResponseSchema |
| 171 | +{ |
| 172 | +} |
0 commit comments