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

Determine how to deal with multiple audiences for jwt.Credentials #114

Closed
theacodes opened this issue Feb 17, 2017 · 2 comments
Closed

Determine how to deal with multiple audiences for jwt.Credentials #114

theacodes opened this issue Feb 17, 2017 · 2 comments
Assignees
Labels
discussion 🚨 This issue needs some love. triage me I really want to be triaged.
Milestone

Comments

@theacodes
Copy link
Contributor

JWT bearer credentials require an audience that matches the service URL to work.

Right now, JWT credentials don't require an audience when constructing, but instead can generate a one-time token during before_request. This works, but unfortunately this is pretty awful performance-wise.

My best as to why we did this is because within one client we may actually be talking to two different audiences. Consider pubusb - there is the publisher audience (https://pubsub.googleapis.com/google.pubsub.v1.Publisher) and the subscriber audience (https://pubsub.googleapis.com/google.pubsub.v1.Subscriber).

I see two options for making this better:

  1. Store a cache of tokens for every given audience. This has lots of problems.
  2. Make our clients pass in credentials.with_claims(audience='...') (example here) instead of just credentials. This means that we'll essentially be using a copy of the credentials for each audience (pubsub will have two), so they will likely refresh at different times (which I don't consider a problem).

@dhermes @lukesneeringer thoughts?

@theacodes theacodes added this to the 1.0.0 milestone Feb 17, 2017
@dhermes
Copy link
Contributor

dhermes commented Feb 18, 2017

  1. I don't understand the "pretty awful performance-wise" piece you are referring to
  2. I don't see much wrong with asking the caller to be aware of the audience. Libraries like google-cloud-python can handle this without being a burden on users.

@theacodes
Copy link
Contributor Author

I don't understand the "pretty awful performance-wise" piece you are referring to

Generating a new JWT for every request adds a lot of overhead. It's much better to only generate that once.

I don't see much wrong with asking the caller to be aware of the audience.

Great, I'll do what I described in (2) above. I'll remove the per-request one-time JWT logic. We can always add that back as a new credential type later if needed, but if we hit 1.0 with that behavior we're married to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants