Skip to content
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

Merged
merged 7 commits into from
Jun 22, 2021

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Jun 10, 2021

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 10, 2021
src/Credentials/ServiceAccountCredentials.php Outdated Show resolved Hide resolved
return null;
}

if (!empty($audience) && !empty($scope)) {
throw new UnexpectedValueException(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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.

Copy link
Contributor

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');
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, added!

@bshaffer bshaffer merged commit 866e497 into master Jun 22, 2021
@bshaffer bshaffer deleted the implement-jwt-access-param branch June 22, 2021 17:56
gcf-merge-on-green bot pushed a commit to googleapis/gax-php that referenced this pull request Aug 20, 2021
**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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants