Add OAuth providers migration#191
Conversation
…nto add-oauth-providers-migration
Greptile SummaryThis PR introduces
Confidence Score: 5/5Safe to merge; the change is additive, secrets are correctly withheld, and the destination read-merge-write path is sound. The logic is well-structured and the known edge cases (write-only secrets, the Apple credential blob, JSON-secret providers) are handled correctly. The only gap found is that WithEndpointProvider does not override isConfigured() to include the endpoint field, meaning a disabled OIDC/Keycloak/Gitlab provider that has an endpoint URL saved but no clientId would be skipped during export and the endpoint lost post-migration. src/Migration/Resources/Auth/OAuth2/WithEndpointProvider.php — isConfigured() should also check the endpoint field so that partially-configured OIDC-family providers are not silently dropped. Important Files Changed
Reviews (17): Last reviewed commit: "OAuth2 export: null-guard listOAuth2Prov..." | Re-trigger Greptile |
…oved oAuthProviders off Models\Project)
… broken sign-in flow)
… non-secret fields
…atus counter size limit)
- Destination: dispatch via explicit case Resource::TYPE_OAUTH2_PROVIDER instead of default + instanceof - Source: count in report() directly like sibling resources (drop try/catch), and move the in_array guard inside the export try - Harden mergeAppleSecret/mergeJsonSecret against non-array decoded JSON - Fix stale OAuth2Provider docblock (single shared TYPE, not per-subclass)
- mergeAppleSecret now delegates to mergeJsonSecret (one merge implementation) - exportOAuth2Providers surfaces providers with no Resource class as non-fatal errors instead of dropping them silently - report() counts only migratable providers; fix the misleading enabled comment - use elseif for the mutually-exclusive provider-shape branches - add AppwriteOAuth2SecretTest (secret-merge) and OAuth2ProviderTransferTest (transfer round-trip via MockSource/MockDestination)
…rage Other migration resources (auth methods, policies, …) ship no per-resource tests in this library; keep OAuth2 consistent with that baseline.
…these; were unmapped)
Summary
TYPE_OAUTH_PROVIDERStoGROUP_AUTH_RESOURCESfor migrating the project's OAuth2 provider configuration map.Sources/Appwrite) reads$project->oAuthProvidersand emits oneOAuthProviderssingleton carryingkey/enabled/appIdfor each provider.Destinations/Appwrite) merges the entries into the project doc'soAuthProvidersmap as flat{key}Enabled/{key}Appidkeys viadbForPlatform(mirrors the destination path used byauth-methods/policies).{key}Secretis intentionally not migrated — the source API never exposes secrets and the destination user must re-enter them post-migration. Same caveat as the SMTP password handling.GROUP_AUTH(notGROUP_INTEGRATIONS) — OAuth providers are auth methods that happen to use external identity providers; same group asTYPE_AUTH_METHODSandTYPE_POLICIES.Test plan
testAppwriteMigrationOAuthProviders(in appwrite/appwrite) passes