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(auth): add base auth package #8465

Merged
merged 8 commits into from
Aug 23, 2023
Merged

Conversation

codyoss
Copy link
Member

@codyoss codyoss commented Aug 22, 2023

This package provides:

  • A TokenProvider interface
  • A Token type
  • A standard auth Error type
  • Configuration and TokenProvider for 2L0 oauth2 flows
  • Configuration and TokenProvider for 3L0 oauth2 flows
  • A means to cache tokens

This code has been adapted from the golang oauth2 repo. In particular the types here are analogous to: oauth2, authhandler, and jwt packages. It should feel familiar for anyone who as worked with that library before, but it only provides a subset of the features that we require for our client libraries and auth stack as defined by our AIPs.

This package provides:
- A TokenProvider interface
- A Token type
- A standard auth Error type
- Configuration for 2L0 oauth2 flows
- Configuration for 3L0 oauth2 flows

This code has been adapted from the golang oauth2 repo. It should
feel familiar for anyone who as worked with that library before,
but it only provdies a sub-set of the features that we require for
our client libraries.
@codyoss codyoss requested a review from a team as a code owner August 22, 2023 14:56
@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Aug 22, 2023
codyoss and others added 3 commits August 22, 2023 09:56
- switch to use * types
- use the Option name consistently
.release-please-manifest-individual.json Outdated Show resolved Hide resolved
auth/auth.go Outdated Show resolved Hide resolved
auth/auth.go Outdated Show resolved Hide resolved
auth/auth_test.go Outdated Show resolved Hide resolved
auth/auth_test.go Outdated Show resolved Hide resolved
auth/auth.go Show resolved Hide resolved
auth/internal/jwt/jwt.go Show resolved Hide resolved
auth/internal/jwt/jwt.go Outdated Show resolved Hide resolved
auth/internal/jwt/jwt.go Show resolved Hide resolved
auth/threelegged.go Show resolved Hide resolved
auth/README.md Outdated Show resolved Hide resolved
auth/auth.go Show resolved Hide resolved
auth/auth.go Show resolved Hide resolved
auth/auth.go Outdated Show resolved Hide resolved
@codyoss codyoss added the automerge Merge the pull request once unit tests and other checks pass. label Aug 23, 2023
@gcf-merge-on-green gcf-merge-on-green bot merged commit 6a45f26 into googleapis:main Aug 23, 2023
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 23, 2023
@codyoss codyoss deleted the auth1 branch August 23, 2023 19:53
@release-please release-please bot mentioned this pull request Aug 25, 2023
hongalex added a commit that referenced this pull request Aug 31, 2023
* feat(pubsub): add publish tracing

* refactor tests to use InMemoryExporter

* update copyright year

* run go mod tidy

* rename PubsubMessageCarrier -> MessageCarrier, fix race

* make messageCarrier not exported

* downgrade otel sdk version to support go1.17

* add short delay to ensure spans are exported

* context renaming

* chore(ci): fix yaml syntax (#8448)

* chore: release main (#8445)

:robot: I have created a release *beep* *boop*
---


<details><summary>policytroubleshooter: 1.9.0</summary>

## [1.9.0](https://togithub.com/googleapis/google-cloud-go/compare/policytroubleshooter/v1.8.0...policytroubleshooter/v1.9.0) (2023-08-18)


### Features

* **policytroubleshooter/iam:** Start generating apiv3 ([#8444](https://togithub.com/googleapis/google-cloud-go/issues/8444)) ([fb1a8cc](https://togithub.com/googleapis/google-cloud-go/commit/fb1a8ccfa81b8b36658207e333ee83666c87be75))
</details>

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* chore(notebooks): add config to generate apiv2 (#8454)

* feat(notebooks): clients for Notebooks API V2 (#8455)

- [ ] Regenerate this pull request now.

docs: supports Workbench Instances

https://cloud.google.com/vertex-ai/docs/workbench/reference/rest

PiperOrigin-RevId: 558178233

Source-Link: https://togithub.com/googleapis/googleapis/commit/ad329f84c0876a6f28026a01be584d3134a4df72

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/77e1a0df50f67c0e1c9a9fd768c82f931f601cec
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzdlMWEwZGY1MGY2N2MwZTFjOWE5ZmQ3NjhjODJmOTMxZjYwMWNlYyJ9

* chore(ci): find changes on most recent main commit (#8457)

* chore: add datastore to allowlist of things to generate still (#8458)

* chore: release main (#8456)

:robot: I have created a release *beep* *boop*
---


<details><summary>notebooks: 1.10.0</summary>

## [1.10.0](https://togithub.com/googleapis/google-cloud-go/compare/notebooks/v1.9.1...notebooks/v1.10.0) (2023-08-21)


### Features

* **notebooks:** Clients for Notebooks API V2 ([#8455](https://togithub.com/googleapis/google-cloud-go/issues/8455)) ([1859e6c](https://togithub.com/googleapis/google-cloud-go/commit/1859e6ca01499ed297167aef60ae1d34a2ed24ea))
</details>

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* fix(bigquery): value for datasetID on foreign keys (#8447)

Fixes #8442

* feat(datastore): SUM and AVG aggregations (#8307)

* feat(datastore): SUM and AVG aggregations

* feat(datastore): Fixing integration tests for SUM AVG

* feat(datastore): Fixing integration tests

* feat(datastore): Fixing integration tests

* feat(datastore): Updating protos

* feat(datastore): updating protos

* feat(datastore): Undo go.work.sum changes

* feat(datastore): Used new protos

* feat(datastore): Use latest protos

---------

Co-authored-by: meredithslota <[email protected]>
Co-authored-by: kolea2 <[email protected]>

* feat(datastore): Support aggregation query in transaction (#8439)

* feat(datastore): Support aggregation query in transaction

* feat(datastore): Refactoring integration test

* feat(datastore): Integration tests for sum and average

* chore(main): release datastore 1.14.0 (#8351)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* add helper functions for creating publish spans

* refactor error tests

* fix(spanner): Transaction was started in a different session (#8467)

* fix: Transaction was started in a different session

Retrying a "Session not found" error could cause a "Transaction was
started in a different session" error. This happened because:
1. The detection of a "Session not found" error would remove the session
   from the pool, and also remove the session ID from the session handle
2. The retry mechanism would check out a new session from the pool, but
   not assign it to the transaction yet
3. The retry would then proceed to retry the transaction with an
   explicit BeginTransaction RPC. This function would however pick a new
   session from the pool, because step 2 had not yet assigned the
   transaction a new session.
4. The higher level retry loop would then after executing the
   BeginTransaction RPC assign the session that was picked in step 2 to
   the transaction.
5. The transaction would then proceed to use the session from step 2
   with the transaction from step 3.

* chore: remove unused code

* chore: fix import order

* feat(spanner/spannertest): support INSERT DML (#7820)

Co-authored-by: rahul2393 <[email protected]>

* test(datastore): Truncate transaction read time to millisecond (#8473)

* fix(datastore): Truncate transaction read time to millisecond

* fix(datastore): Truncate transaction read time to microsecond

* feat(auth): add base auth package (#8465)

This package provides:
- A TokenProvider interface
- A Token type
- A standard auth Error type
- Configuration and TokenProvider for 2L0 oauth2 flows
- Configuration and TokenProvider for 3L0 oauth2 flows
- A means to cache tokens

This code has been adapted from the golang oauth2 repo. In particular the types here are analogous to: oauth2, authhandler, and jwt packages. It should feel familiar for anyone who as worked with that library before, but it only provides a subset of the features that we require for our client libraries and auth stack as defined by our AIPs.

* test(datastore): Correct read time before creating entities (#8475)

* chore(main): release spanner 1.49.0 (#8468)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore(ci): increase new-client fetch depth (#8483)

* feat(spanner/spansql): add support for bit functions, sequence functions and GENERATE_UUID (#8482)

* feat(spanner/spansql): add support for bit functions and sequence functions

* feat(spanner/spansql): add support for function GENERATE_UUID

* test(storage): increase timeout for requester pays test (#8421)

Increasing timeout to give some leeway. If the test continues flaking, we should investigate further why it fails.

* test(pubsublite): fix flaky TestRoutingPublisherUnloadIdlePublisher (#8478)

Fixes: https://togithub.com/googleapis/google-cloud-go/issues/7942

* test(pubsublite): fix flaky TestIntegration_SeekSubscription (#8479)

Fixes: https://togithub.com/googleapis/google-cloud-go/issues/7454

* feat(spanner): allow non-default service accounts (#8488)

* feat(spanner/spansql): add support for SEQUENCE statements (#8481)

* feat(spanner/spansql): add support for SEQUENCE statements

* feat(spanner/spansql): remove using generics for CI env

---------

Co-authored-by: Sri Harsha CH <[email protected]>
Co-authored-by: rahul2393 <[email protected]>

* chore(config): add config to generate apiv1 (#8490)

* feat(container): add support for NodeConfig Update (#8461)

feat: publicize tpu topology in v1 API
PiperOrigin-RevId: 560116372

Source-Link: googleapis/googleapis@cf6f9ee

Source-Link: googleapis/googleapis-gen@b618aaf
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjYxOGFhZmE2NDE3NDFhNTYxNWMyMTZiODc4NjAwNjViZGMzMGY4ZCJ9
BEGIN_NESTED_COMMIT
feat(bigquery/datapolicies): support using custom UDF in the data policy
PiperOrigin-RevId: 559480224

Source-Link: googleapis/googleapis@4ffd6cd

Source-Link: googleapis/googleapis-gen@2fa3b74
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZhM2I3NDk2ZjkyNzQ1YjE4N2QxYmI1ZjllNjVlNWQwMzZhNWQwNyJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
docs(optimization): Minor formatting fix

PiperOrigin-RevId: 559474510

Source-Link: googleapis/googleapis@5b3202b

Source-Link: googleapis/googleapis-gen@7b6e921
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2I2ZTkyMTA4NTEzZDBmZjIxNjE0ZTBkYTZmYzgyNzkxNjFlNTVhMyJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
docs(datacatalog): fix typo

PiperOrigin-RevId: 559249168

Source-Link: googleapis/googleapis@f49882a

Source-Link: googleapis/googleapis-gen@08d36c5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDhkMzZjNTkzYWI2MGYxODRhZmUxNDIzYTg0ZGY5NDJlMmFmMmRmMiJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
docs(billing): update comments

PiperOrigin-RevId: 559241398

Source-Link: googleapis/googleapis@6fe53ad

Source-Link: googleapis/googleapis-gen@11b03ab
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTFiMDNhYjZmOWNmMDBjYmNkMTY3MWFmN2Y1ZDcxMzQ4ZjI1NmE3NCJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(billing/budgets): Supported project-level-budgets in Public Budget API V1

Added scope for project scope filter in ListBudgetsRequest. When this field is set to a project's resource name, the budgets returned are tracking the costs for the given project.

feat: Added enable_project_level_recipients for project owner budget emails

Setting this field to true will enable email notification to project owners for project-level budgets.

PiperOrigin-RevId: 559152052

Source-Link: googleapis/googleapis@113867b

Source-Link: googleapis/googleapis-gen@017d177
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDE3ZDE3N2Y1MTQ2OWQxNTA0MTdiN2I2YTQ1ZDk5ZDk5NjNmNzgxMyJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(billing/budgets): Supported project-level-budgets in Public Budget API V1Beta

Added scope for project scope filter in ListBudgetsRequest. When this field is set to a project's resource name, the budgets returned are tracking the costs for the given project.

feat: Added enable_project_level_recipients for project owner budget emails

Setting this field to true will enable email notification to project owners for project-level budgets.

PiperOrigin-RevId: 559151636

Source-Link: googleapis/googleapis@138b0f1

Source-Link: googleapis/googleapis-gen@41c0ba8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDFjMGJhODk5Zjc2Y2JiZmFjZGRlY2NmN2M3Njk3NDdhY2FmZTI2ZCJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(dataproc): support min_num_instances for primary worker and InstanceFlexibilityPolicy for secondary worker

PiperOrigin-RevId: 559135594

Source-Link: googleapis/googleapis@4a5a6fd

Source-Link: googleapis/googleapis-gen@5c91126
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWM5MTEyNjFmMDAyNTdmNzY4YThhMzIzYWExYTNlNDgzNjQwYzFkMiJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
docs(batch): Revert HTML formats in comments

docs: Expand compute resource API docs to match with VM's machine type field

docs: Clarify Batch API proto doc about pubsub notifications
PiperOrigin-RevId: 558940776

Source-Link: googleapis/googleapis@a7ee700

Source-Link: googleapis/googleapis-gen@4f3a485
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGYzYTQ4NWYzY2ViMTNiNjdlMDUyMmI3NGE3ZmQ5Y2NkZTJhYTZhMSJ9
END_NESTED_COMMIT

* feat(config): new clients (#8493)

* feat(spanner/spansql): add support for aggregate functions (#8498)

* fix exactly once delivery test

* fix(pubsub): make AckWithResult return success when constructed (#8489)

---------

Co-authored-by: Noah Dietz <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Chris Smith <[email protected]>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Cody Oss <[email protected]>
Co-authored-by: Alvaro Viebrantz <[email protected]>
Co-authored-by: Baha Aiman <[email protected]>
Co-authored-by: meredithslota <[email protected]>
Co-authored-by: kolea2 <[email protected]>
Co-authored-by: Knut Olav Løite <[email protected]>
Co-authored-by: go_vargo <[email protected]>
Co-authored-by: rahul2393 <[email protected]>
Co-authored-by: TOGASHI Tomoki <[email protected]>
Co-authored-by: Brenna N Epp <[email protected]>
Co-authored-by: tmdiep <[email protected]>
Co-authored-by: Roman Slyusarchuk <[email protected]>
Co-authored-by: Sri Harsha CH <[email protected]>
Co-authored-by: Julie Qiu <[email protected]>
Co-authored-by: yoshi-code-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants