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

oauth2: add www-authenticate header in case of unauthorized error for userinfo endpoint #1891

Merged
merged 2 commits into from
Jun 5, 2020

Conversation

bayansar
Copy link
Contributor

@bayansar bayansar commented Jun 3, 2020

Related issue

Here is the issue that this PR is trying to fix /userinfo endpoint misses www-authenticate header for 401 response #1827

Proposed changes

As far as I understood, apparently there are two cases that /userinfo API returns 401 error. One is if introspection API returns 401 and the other one is if token type is not fosite.AccessToken. Thus, I covered these two cases by adding www-authenticate header with reason coming from RFC6749Error

I've also added a new test case but needed small changes to make it happen.

This is my first PR, and I'm not familiar with the codebase. I'd be glad to hear better ways to do these changes if any.

Checklist

  • I have read the contributing guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security. vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further comments

@CLAassistant
Copy link

CLAassistant commented Jun 3, 2020

CLA assistant check
All committers have signed the CLA.

@bayansar bayansar changed the title Bug 1827 oauth2:add new test case for userinfo unauthorized case Jun 3, 2020
@bayansar bayansar changed the title oauth2:add new test case for userinfo unauthorized case oauth2: add www-authenticate header in case of unauthorized error for userinfo endpoint Jun 3, 2020
@aeneasr
Copy link
Member

aeneasr commented Jun 5, 2020

Good job and thank you for the contribution :)

@heinzburgstaller
Copy link

This is the same for then /oauth2/token endpoint. If there is a 401 response the response header "WWW-Authenticate" is missing

@aeneasr
Copy link
Member

aeneasr commented Apr 5, 2022

Contributions welcomed!

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.

None yet

4 participants