Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 156
Add application credential authentication type#354
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -108,15 +108,20 @@ public function create(array $data): Creatable | ||
| if (!isset($data['user']['id']) && empty($data['user']['domain'])) { | ||
| throw new \InvalidArgumentException('When authenticating with a username, you must also provide either the domain name or domain ID to '.'which the user belongs to. Alternatively, if you provide a user ID instead, you do not need to '.'provide domain information.'); | ||
| } | ||
| } elseif (isset($data['tokenId'])) { | ||
| } elseif (isset($data['application_credential'])) { | ||
| $data['methods'] = ['application_credential']; | ||
| if (!isset($data['application_credential']['id']) && empty($data['application_credential']['secret'])) { | ||
| throw new \InvalidArgumentException('To authenticate with an application credential, specify “application_credential” as the auth method. The ID of the application credential used for authentication. The secret for authenticating the application credential.'); | ||
| } | ||
| } elseif (isset($data['tokenId'])) { | ||
| $data['methods'] = ['token']; | ||
| } else { | ||
| throw new \InvalidArgumentException('Either a user or token must be provided.'); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error is not valid anymore. Add application_credentials there. | ||
| } | ||
| $response = $this->execute($this->api->postTokens(), $data); | ||
| $definition = (isset($data['user']) || isset($data['tokenId'])) ? $this->api->postTokens() : $this->api->postApplicationCredentialsTokens(); | ||
| $response = $this->execute($definition, $data); | ||
| $token = $this->populateFromResponse($response); | ||
| // Cache response as an array to export if needed. | ||
| // Added key `id` which is auth token from HTTP header X-Subject-Token | ||
| $this->cachedToken = Utils::flattenJson(Utils::jsonDecode($response), $this->resourceKey); | ||
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.
this file should be removed