-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat: allow ServiceAccountJwtAccessCredentials to sign scopes #341
Conversation
return null; | ||
} | ||
|
||
if (!empty($audience) && !empty($scope)) { | ||
throw new UnexpectedValueException( |
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.
throw new UnexpectedValueException( | |
throw new \UnexpectedValueException( |
Would we be able to document this being thrown? Wondering if we need a test for this as well.
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.
Good catch and yes, I added a test!
I'm happy to add @throws
. In this library in general (not that it's the right thing to do), we haven't been documenting thrown exceptions.
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.
I trust your judgement 👍
if (!(is_null($this->getScope()))) { | ||
$assertion['scope'] = $this->getScope(); | ||
} | ||
|
||
if (empty($assertion['scope']) && empty($assertion['aud'])) { | ||
throw new \DomainException('one of scope or aud should not be null'); |
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.
Do we need a test to exercise this?
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.
good point, added!
Co-authored-by: David Supplee <[email protected]>
**TODO** - [x] Merge and tag googleapis/google-auth-library-php#341 - [x] Update minimum `google/auth` version in `composer.json` to the new tag ([v1.16.0](https://github.com/googleapis/google-auth-library-php/releases/tag/v1.16.0)) - [x] Add `'useJwtAccessWithScopes' => false` to `gapic-generator-php` for DIREGAPIC APIs (done in googleapis/gapic-generator-php#309) - [x] Generate a new [Gapic Compute client](https://github.com/googleapis/google-cloud-php/tree/master/Compute) with the changes in googleapis/gapic-generator-php#309 _Note_: These steps are now optional because Compute does not need the exclusion for Self-Signed JWTs with Scopes - [ ] Merge googleapis/google-cloud-php#4199 - [ ] Tag a new version of `google/cloud-compute` - [ ] Merge _this PR_ - [ ] Tag a new version of _this library_ (`google/gax`) - [ ] Update [Gapic Compute client](https://github.com/googleapis/google-cloud-php/tree/master/Compute) requires [the latest tag of google/gax](https://github.com/googleapis/google-cloud-php/blob/master/Compute/composer.json#L8)
See https://google.aip.dev/auth/4111#scope-vs-audience
cc @shinfan