|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\Swagger\schemas; |
| 4 | + |
| 5 | +use OAuth2\AddressClaim; |
| 6 | +use OAuth2\StandardClaims; |
| 7 | +use OpenApi\Attributes as OA; |
| 8 | + |
| 9 | +#[OA\Schema( |
| 10 | + schema: 'UserInfoAddressClaim', |
| 11 | + title: 'Address Claim', |
| 12 | + description: 'OpenID Connect Address Claim (RFC 5.1.1)', |
| 13 | + type: 'object', |
| 14 | + properties: [ |
| 15 | + new OA\Property(property: AddressClaim::Country, type: 'string', description: 'Country name'), |
| 16 | + new OA\Property(property: AddressClaim::StreetAddress, type: 'string', description: 'Full street address component'), |
| 17 | + new OA\Property(property: AddressClaim::Address1, type: 'string', description: 'Address line 1'), |
| 18 | + new OA\Property(property: AddressClaim::Address2, type: 'string', description: 'Address line 2'), |
| 19 | + new OA\Property(property: AddressClaim::PostalCode, type: 'string', description: 'Zip code or postal code'), |
| 20 | + new OA\Property(property: AddressClaim::Region, type: 'string', description: 'State, province, or region'), |
| 21 | + new OA\Property(property: AddressClaim::Locality, type: 'string', description: 'City or locality'), |
| 22 | + new OA\Property(property: AddressClaim::Formatted, type: 'string', description: 'Full mailing address, formatted for display'), |
| 23 | + ] |
| 24 | +)] |
| 25 | +class UserInfoAddressClaimSchema |
| 26 | +{ |
| 27 | +} |
| 28 | + |
| 29 | +#[OA\Schema( |
| 30 | + schema: 'UserInfoResponse', |
| 31 | + title: 'UserInfo Response', |
| 32 | + description: 'OpenID Connect UserInfo endpoint response. Claims returned depend on the requested scopes (profile, email, address).', |
| 33 | + type: 'object', |
| 34 | + required: [StandardClaims::SubjectIdentifier, 'aud'], |
| 35 | + properties: [ |
| 36 | + // JWT standard claims |
| 37 | + new OA\Property(property: StandardClaims::SubjectIdentifier, type: 'string', description: 'Subject identifier for the End-User'), |
| 38 | + new OA\Property(property: 'aud', type: 'string', description: 'Audience (client ID)'), |
| 39 | + |
| 40 | + // Profile scope claims |
| 41 | + new OA\Property(property: StandardClaims::Name, type: 'string', description: 'Full name'), |
| 42 | + new OA\Property(property: StandardClaims::GivenName, type: 'string', description: 'First name'), |
| 43 | + new OA\Property(property: StandardClaims::PreferredUserName, type: 'string', description: 'Preferred username'), |
| 44 | + new OA\Property(property: StandardClaims::FamilyName, type: 'string', description: 'Last name'), |
| 45 | + new OA\Property(property: StandardClaims::NickName, type: 'string', description: 'Casual name or identifier'), |
| 46 | + new OA\Property(property: StandardClaims::Picture, type: 'string', format: 'uri', description: 'Profile picture URL'), |
| 47 | + new OA\Property(property: StandardClaims::Birthdate, type: 'string', description: 'Date of birth'), |
| 48 | + new OA\Property(property: StandardClaims::Gender, type: 'string', description: 'Gender'), |
| 49 | + new OA\Property(property: StandardClaims::GenderSpecify, type: 'string', description: 'Gender specification'), |
| 50 | + new OA\Property(property: StandardClaims::Locale, type: 'string', description: 'Preferred language'), |
| 51 | + new OA\Property(property: StandardClaims::Bio, type: 'string', description: 'User biography'), |
| 52 | + new OA\Property(property: StandardClaims::StatementOfInterest, type: 'string', description: 'Statement of interest'), |
| 53 | + new OA\Property(property: StandardClaims::Irc, type: 'string', description: 'IRC handle'), |
| 54 | + new OA\Property(property: StandardClaims::GitHubUser, type: 'string', description: 'GitHub username'), |
| 55 | + new OA\Property(property: StandardClaims::WeChatUser, type: 'string', description: 'WeChat username'), |
| 56 | + new OA\Property(property: StandardClaims::TwitterName, type: 'string', description: 'Twitter handle'), |
| 57 | + new OA\Property(property: StandardClaims::LinkedInProfile, type: 'string', description: 'LinkedIn profile URL'), |
| 58 | + new OA\Property(property: StandardClaims::Company, type: 'string', description: 'Company name'), |
| 59 | + new OA\Property(property: StandardClaims::JobTitle, type: 'string', description: 'Job title'), |
| 60 | + new OA\Property(property: StandardClaims::ShowPicture, type: 'boolean', description: 'Show photo in public profile'), |
| 61 | + new OA\Property(property: StandardClaims::ShowBio, type: 'boolean', description: 'Show bio in public profile'), |
| 62 | + new OA\Property(property: StandardClaims::ShowSocialMediaInfo, type: 'boolean', description: 'Show social media info in public profile'), |
| 63 | + new OA\Property(property: StandardClaims::ShowFullName, type: 'boolean', description: 'Show full name in public profile'), |
| 64 | + new OA\Property(property: StandardClaims::AllowChatWithMe, type: 'boolean', description: 'Allow chat in public profile'), |
| 65 | + new OA\Property(property: StandardClaims::ShowTelephoneNumber, type: 'boolean', description: 'Show telephone in public profile'), |
| 66 | + new OA\Property( |
| 67 | + property: StandardClaims::Groups, |
| 68 | + type: 'array', |
| 69 | + items: new OA\Items(ref: '#/components/schemas/Group'), |
| 70 | + description: 'User groups' |
| 71 | + ), |
| 72 | + |
| 73 | + // Email scope claims |
| 74 | + new OA\Property(property: StandardClaims::Email, type: 'string', format: 'email', description: 'Primary email address'), |
| 75 | + new OA\Property(property: StandardClaims::SecondEmail, type: 'string', format: 'email', description: 'Secondary email address'), |
| 76 | + new OA\Property(property: StandardClaims::ThirdEmail, type: 'string', format: 'email', description: 'Tertiary email address'), |
| 77 | + new OA\Property(property: StandardClaims::EmailVerified, type: 'boolean', description: 'Whether the primary email is verified'), |
| 78 | + new OA\Property(property: StandardClaims::ShowEmail, type: 'boolean', description: 'Whether to show the email or not'), |
| 79 | + |
| 80 | + // Address scope claims |
| 81 | + new OA\Property( |
| 82 | + property: StandardClaims::Address, |
| 83 | + ref: '#/components/schemas/UserInfoAddressClaim', |
| 84 | + description: 'End-User preferred postal address (address scope)' |
| 85 | + ), |
| 86 | + ] |
| 87 | +)] |
| 88 | +class UserInfoResponseSchema |
| 89 | +{ |
| 90 | +} |
0 commit comments