Skip to content

Combine User and UserTokenContext for user-backed identities in requests #15757

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

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

facutuesca
Copy link
Contributor

@facutuesca facutuesca commented Apr 11, 2024

Fixes #15748.

We have three types that a request.identity can be:

  • User: when the identity is a user backed by a login session
  • UserTokenContext: when the identity is a user backed by an API token (i.e. macaroon)
  • PublisherTokenContext: when the identity is an OIDCPublisher backed by an API token

Of these, User and UserTokenContext are confusable and prone to error.

This PR collapses them into a single UserContext type.

cc @woodruffw @di

@facutuesca facutuesca requested a review from a team as a code owner April 11, 2024 17:23
@facutuesca facutuesca changed the title Combine User and UserTokenContext for user-backed identities Combine User and UserTokenContext for user-backed identities Apr 11, 2024
@facutuesca facutuesca changed the title Combine User and UserTokenContext for user-backed identities Combine User and UserTokenContext for user-backed identities in requests Apr 11, 2024
@woodruffw woodruffw self-requested a review April 11, 2024 20:46
@facutuesca facutuesca force-pushed the combine-request-identity-user branch 3 times, most recently from 4cc055f to d3bf7f2 Compare April 18, 2024 14:31
We have three types that a request.identity can be:

- `User`: when the identity is a user backed by a login session
- `UserTokenContext`: when the identity is a user backed by an API token (i.e. macaroon)
- `PublisherTokenContext`: when the identity is an OIDCPublisher backed by an API token

Of these, User and UserTokenContext are confusable and prone to error. This change
collapses them into a single UserContext type.
@facutuesca facutuesca force-pushed the combine-request-identity-user branch from d3bf7f2 to 937b087 Compare June 17, 2024 09:58
Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @facutuesca!

@di di merged commit 609871e into pypi:main Jul 1, 2024
17 checks passed
@di di deleted the combine-request-identity-user branch July 1, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Userrequest.identity usages with UserContext
3 participants