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

fix: prompt=none shows a login screen #1361

Merged
merged 2 commits into from
Nov 26, 2023

Conversation

andyzickler
Copy link
Contributor

@andyzickler andyzickler commented Nov 10, 2023

Fixes #1268

Description of the Change

Fix bug preventing support for Silent Authentication. If an unauthorized request to AuthorizationView with a query parameter that contains prompt=none happens, then we will redirect with an error code of login_required otherwise everything will proceed as before.

See https://auth0.com/docs/authenticate/login/configure-silent-authentication#error-responses
and https://openid.net/specs/openid-connect-core-1_0.html#AuthError

fully supporting prompt=none will require implementing validate_silent_login in the validator. this doesn't implement that, but will allow people to implement it if they want until we can implement a good implementation for DOT.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a4b26b1) 97.54% compared to head (d8c0a70) 97.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1361      +/-   ##
==========================================
+ Coverage   97.54%   97.56%   +0.01%     
==========================================
  Files          32       32              
  Lines        2120     2132      +12     
==========================================
+ Hits         2068     2080      +12     
  Misses         52       52              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andyzickler
Copy link
Contributor Author

This PR was a bit optimistic and naïve. Tests written via spec passed, but not in real world testing with the ldp and rp apps. Future implementation likely needs to implement oauthlib's validate_silent_login

@dopry
Copy link
Contributor

dopry commented Nov 21, 2023

I think it was on the right track. Let's isolate the dispatch fixes so someone could at least in theory implement validate_silent_login

@dopry dopry reopened this Nov 25, 2023
@dopry dopry force-pushed the feat/silent-login branch from 5681e2e to c0cb28f Compare November 25, 2023 03:20
@dopry dopry changed the title Add prompt=none support (#1268) fix: prompt=none shows a login screen Nov 25, 2023
@dopry dopry force-pushed the feat/silent-login branch 5 times, most recently from 81313bd to 404e248 Compare November 25, 2023 04:59
@dopry dopry force-pushed the feat/silent-login branch from c00b681 to 36121c5 Compare November 25, 2023 16:47
@dopry dopry requested review from n2ygk, tonial and AlanCoding November 25, 2023 17:14
@dopry
Copy link
Contributor

dopry commented Nov 25, 2023

@n2ygk @tonial I'd love to get a review from you guys on this. I've been working on it with @andyzickler. This bug is blocking an SSO implementation for me I'd really like to complete.

Copy link
Contributor

@tonial tonial left a comment

Choose a reason for hiding this comment

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

I made a few comments on the tests, but the implementation seems correct to me.

Great addition !

scheme, netloc, path, params, query, fragment = urlparse(response["Location"])
parsed_query = parse_qs(query)

self.assertIn("login_required", parsed_query["error"])
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use self.assertEqual(parsed_query, expected_dict) to be sure we don't add anything else.

"response_type": "code",
"state": "random_state_string",
"scope": "read write",
"redirect_uri": "http://example.org",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a query parameter, or add another test with a query parameter in the redirect_url to test the seperator computed line 268 in handle_no_permission()

@n2ygk n2ygk merged commit 322154b into jazzband:master Nov 26, 2023
25 checks passed
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.

prompt=none redirects to login screen.
4 participants