auth: OAuth2 clients, identity validators, and Phone calling codes - #137
Draft
eldadfux wants to merge 4 commits into
Draft
auth: OAuth2 clients, identity validators, and Phone calling codes#137eldadfux wants to merge 4 commits into
eldadfux wants to merge 4 commits into
Conversation
Add relying-party OAuth2 adapters (including VCS helpers, PKCE, and the Appwrite Cloud provider) under Utopia\Auth\OAuth2\Provider, with unit coverage and WireMock e2e tests. Password and identity input rules move to Utopia\Auth\Validator. Phone numbers with a known ITU-T calling code belong on utopia-php/validators via CallingCode and Phone(knownCallingCode: true). Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Allow Vale to accept "allowlists" and "Etsy", apply Rector's Phone/CallingCode simplifications, and relock dns onto validators 0.5 so linked Docker installs succeed. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Benchmark resultsdns — transport throughput (4 cores, 250 repeats x 20 workers x 3 domains per transport)
Shared CI runners — treat absolute numbers as rough, compare modes within a run. Commit 9e6c5e1. |
Numeric string keys in the const become integers in PHP, so the phpdoc must be array<int, true> rather than array<string, true>. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Phone(knownCallingCode: true) is not on Packagist yet. Use the E.164 constructor so Appwrite can require the auth split-dev branch without a custom validators dist. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Moves the reusable Appwrite Auth pieces that still lived in
appwrite/appwriteinto Utopia libraries:validators
Utopia\Validator\CallingCode(ITU-T E.164 country calling codes, no messaging dependency).Phonegains optionalknownCallingCode: true(defaultfalse, so existing callers stay valid).auth
Password,PasswordStrength,PasswordDictionary,PasswordHistory,PersonalData,EmailWhitelist,MockNumber.Utopia\Auth\OAuth2\Provider/Providers(47 adapters, including the hardcoded Appwrite Cloud provider and VCS helpers on GitHub, GitLab, Gitea, Bitbucket).HttpClient(curl by default) so tests can point at WireMock without rewriting adapters.stateEncryptionKeyinstead of reading Appwrite env vars.Utopia\Auth\OAuth2\Exceptionis protocol-level (RFC 6749error/error_description). Product error types stay in Appwrite.Existing authorization-server helpers (
PAR,Prompts,ResourceIndicators, token issuers) are unchanged.MockNumberconstructsnew Phone()so it installs against published validators 0.5.0. After a validators release that includesknownCallingCode, passknownCallingCode: trueagain.CI
Follow-up commits green the Tests workflow:
allowlistsandEtsy.Phone::isValid()and typeCallingCode::CODES.CODESasarray<int, true>(PHP casts numeric string keys to int).packages/dnsontoutopia-php/validators0.5 so linked Dockercomposer installmatches the^0.5constraint (left stale by the validators 0.5 dependents bump).A Split Dev branch
cursor/auth-validators-oauth2-1299is onutopia-php/authfor the Appwrite consume PR (dev-cursor/auth-validators-oauth2-1299 as 0.10.999). The validators mirror is not in this agent's install set, so that package is not split; Appwrite uses published 0.5.0 until a maintainer dispatches Actions → Split Dev forvalidatorson this branch.Test Plan
Phone/CallingCodeunit tests (PHPStan clean).docker compose up --waitstarts WireMock on host port 18080;composer test:e2eexercises GitHub, Google, Appwrite Cloud, and VCScreateRepository()against recorded mappings.Related PRs and Issues