-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK-4393] feat(auth): Support Organization Name with Authorization A…
…PI (#719) <!-- Please only send pull requests to branches that are actively supported. Pull requests without an adequate title, description, or tests will be closed. --> ### Changes > **Note** > Your Auth0 tenant must have this feature enabled to use this. This PR adds support for authorizing using an organization name. This enhances the existing support for authorizing using an organization ID. Example usage follows: ✨ (New) Authorization using an organization name: ```php new Auth0( new SdkConfiguration( organization: ['example-org-name'], ) ); ``` (Existing) support for authorization using an organization ID: ```php new Auth0( new SdkConfiguration( organization: ['org_123456'], ) ); ``` (Updated) The SDK treats the `organization` parameter as an allowlist for applications that need to work with multiple organizations. It now accepts organization names, as well as existing support for IDs. ```php $sdk = new Auth0( new SdkConfiguration( organization: ['org_123456', 'example-org-name', 'another-org-name'], ) ); ``` (Existing) When redirecting for authorization, the `organization` allowlist's first value is used by default. This behavior can be overridden using method parameters: ```php // Redirects to /authorize?organization=org_123456&... header('Location: ' . $sdk->login()); ``` ```php // Redirects to /authorize?organization=org_000000&... header('Location: ' . $sdk->login(params: ['organization': 'org_000000')); ``` ```php // Redirects to /authorize?organization=example-org-name&... header('Location: ' . $sdk->login(params: ['organization': 'example-org-name')); ``` ```php // Redirects to /authorize?... header('Location: ' . $sdk->login(params: ['organization': null)); ``` ### References <!-- Link to any associated issues. --> Please review the internal Jira ticket SDK-4393 for further information. ### Testing <!-- Tests must be added for new functionality, and existing tests should complete without errors. 100% test coverage is required. --> - Tests have been updated to support the new functionality and maintain 100% coverage. - Run `composer test` from a clone of the branch to test locally. - Review the CI test results on the PR otherwise. ### Contributor Checklist - [x] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md) - [x] I have read the [Auth0 code of conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- Loading branch information
Showing
7 changed files
with
170 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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