-
Notifications
You must be signed in to change notification settings - Fork 5
Add OAuth providers migration #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
45926dc
Add OAuth providers migration
premtsd-code 327bcc3
Merge remote-tracking branch 'origin/add-email-templates-migration' i…
premtsd-code f60dc3b
Use listOAuth2Providers SDK call; migrate enabled flag only (SDK 24 m…
premtsd-code 72324bd
Address Greptile review: reorder OAuth export block; guard empty appI…
premtsd-code b0820de
OAuth: skip enabling providers without destination credentials (avoid…
premtsd-code 3269cf3
OAuth2: switch to per-provider Resource classes; migrate all readable…
premtsd-code e809d36
OAuth2: collapse 40 TYPE constants to single TYPE_OAUTH2_PROVIDER (st…
premtsd-code 4829ace
OAuth2: drop conditional-enable guard; propagate enabled as-is across…
premtsd-code 69dabe5
OAuth2: derive provider key from class instead of duplicating in sour…
premtsd-code ce19cdd
OAuth2: match sibling migration style for dispatch, report, and export
premtsd-code d13d2d5
OAuth2: DRY secret merge, surface unmapped providers, add tests
premtsd-code 4168789
Drop OAuth2 tests to match the lib's existing migration-resource cove…
premtsd-code 0d537b6
Merge branch 'add-email-templates-migration' into add-oauth-providers…
premtsd-code 5d63dc6
Register TYPE_OAUTH2_PROVIDER in mock source/destination supported re…
premtsd-code d1387d9
Merge branch 'add-email-templates-migration' into add-oauth-providers…
premtsd-code a1afab9
Trim OAuth2 comments to the critical why; de-duplicate shared rationale
premtsd-code 4ac6933
Add PaypalSandbox/TradeshiftSandbox OAuth2 providers (server enables …
premtsd-code d2a941d
OAuth2: migrate only configured providers (enabled or appId set)
premtsd-code e0741a5
Merge branch 'add-email-templates-migration' into add-oauth-providers…
premtsd-code 6e4e416
OAuth2 export: null-guard listOAuth2Providers response, matching report
premtsd-code 3ce16c5
Consolidate OAuth2 provider resources into a single class
premtsd-code 5810023
Merge branch 'main' into add-oauth-providers-migration
premtsd-code 99def10
Trim OAuth provider migration comments
premtsd-code 09334e6
Improve OAuth provider migration mapping
premtsd-code b797f38
Tidy OAuth2Provider: drop dead getter and de-duplicate emptiness check
premtsd-code dede00a
Fix OAuth provider secret field mappings
premtsd-code f5a9cd9
Remove OAuth provider unit tests
premtsd-code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Amazon extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'amazon'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| /** | ||
| * Apple OAuth2 provider. Bespoke shape — the credential is split across four | ||
| * fields. `serviceId`/`keyId`/`teamId` are readable on the source and | ||
| * migrated; `p8File` is write-only and must be re-entered on the destination. | ||
| */ | ||
| class Apple extends OAuth2Provider | ||
| { | ||
| public function __construct( | ||
| string $id, | ||
| bool $enabled, | ||
| private readonly string $serviceId = '', | ||
| private readonly string $keyId = '', | ||
| private readonly string $teamId = '', | ||
| string $createdAt = '', | ||
| string $updatedAt = '', | ||
| ) { | ||
| parent::__construct($id, $enabled, $createdAt, $updatedAt); | ||
| } | ||
|
|
||
| /** | ||
| * @param array<string, mixed> $array | ||
| */ | ||
| public static function fromArray(array $array): self | ||
| { | ||
| return new self( | ||
| $array['id'], | ||
| (bool) ($array['enabled'] ?? false), | ||
| (string) ($array['serviceId'] ?? ''), | ||
| (string) ($array['keyId'] ?? ''), | ||
| (string) ($array['teamId'] ?? ''), | ||
| createdAt: $array['createdAt'] ?? '', | ||
| updatedAt: $array['updatedAt'] ?? '', | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, mixed> | ||
| */ | ||
| public function jsonSerialize(): array | ||
| { | ||
| return [ | ||
| 'id' => $this->id, | ||
| 'enabled' => $this->enabled, | ||
| 'serviceId' => $this->serviceId, | ||
| 'keyId' => $this->keyId, | ||
| 'teamId' => $this->teamId, | ||
| 'createdAt' => $this->createdAt, | ||
| 'updatedAt' => $this->updatedAt, | ||
| ]; | ||
| } | ||
|
|
||
| public static function getProviderKey(): string | ||
| { | ||
| return 'apple'; | ||
| } | ||
|
|
||
| public function getServiceId(): string | ||
| { | ||
| return $this->serviceId; | ||
| } | ||
|
|
||
| public function getKeyId(): string | ||
| { | ||
| return $this->keyId; | ||
| } | ||
|
|
||
| public function getTeamId(): string | ||
| { | ||
| return $this->teamId; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Auth0 extends WithEndpointProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'auth0'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Authentik extends WithEndpointProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'authentik'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Autodesk extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'autodesk'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Bitbucket extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'bitbucket'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Bitly extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'bitly'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Box extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'box'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Dailymotion extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'dailymotion'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Discord extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'discord'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Disqus extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'disqus'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Dropbox extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'dropbox'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Etsy extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'etsy'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Facebook extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'facebook'; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Utopia\Migration\Resources\Auth\OAuth2; | ||
|
|
||
| class Figma extends StandardProvider | ||
| { | ||
| public static function getProviderKey(): string | ||
| { | ||
| return 'figma'; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we generalize and have 1 class for all? Much easier to maintain