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

authStyleCache keys are not granular enough #654

Open
mateuszmidor opened this issue Jul 18, 2023 · 0 comments
Open

authStyleCache keys are not granular enough #654

mateuszmidor opened this issue Jul 18, 2023 · 0 comments

Comments

@mateuszmidor
Copy link

mateuszmidor commented Jul 18, 2023

The internal "authStyleCache" in golang.org/x/oauth2/internal/token.go is keyed with tokenURL.
This assumes that all applications under given tokenURL will use the same authentication style.
This might not be the case.
Given that I have an account in Okta and configure 2 applications under "https://dev-12345678.okta.com", first one authenticates with ClientSecret and second one with client_assertion, the following scenario fails for me:

  1. first client authenticates with ClientSecret, and authStyleCache stores AuthStyleInHeader for https://dev-12345678.okta.com
  2. second client authenticates with client_assertion, AuthStyleInHeader is read from cache for https://dev-12345678.okta.com, and BasicAuth is set in header, but in the same time client_assertion is set in request body
  3. Okta responds with: oauth2: "invalid_request" "Cannot supply multiple client credentials. Use one of the following: credentials in the Authorization header, credentials in the post body, or a client_assertion in the post body."

I suppose the cache should be keyed with tokenURL+clientID; such combination fixes the problem for me.
Here is what I'm talking about: mateuszmidor@dea60b7
What is your opinion?

mateuszmidor added a commit to mateuszmidor/oauth2 that referenced this issue Jul 18, 2023
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

No branches or pull requests

1 participant