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: registration should accept hydra login #3592

Merged
merged 9 commits into from
Oct 30, 2023
Merged

Conversation

Benehiko
Copy link
Contributor

Related issue(s)

https://github.com/ory-corp/cloud/issues/5493

Using propt=registration on an OAuth2 Hydra login flow, the request is routed to the Kratos registration handler. This handler immediately redirects to the logout flow when there is an already existing session, which fails and ends up at the base /welcome page on the Account Experience (AX).

This PR adds the functionality of accepting the login request in the registration handler if the user has a session and if the hydra skip=true is in the login request.

When the skip=false is set, the request is redirected to the login flow with the login_challenge, which will complete the flow normally.

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code 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 the approval (please contact
    [email protected]) 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

Copy link
Contributor

@hperl hperl left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this! The approach is sensible, I just think we should look for prompt=login instead of skip.

selfservice/flow/registration/handler.go Outdated Show resolved Hide resolved
selfservice/flow/registration/handler.go Outdated Show resolved Hide resolved
@Benehiko Benehiko force-pushed the fix-oauth-registration branch from 78cd2d3 to 71f3634 Compare October 27, 2023 17:09
@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Merging #3592 (0bed0c9) into master (fdf4956) will decrease coverage by 0.03%.
Report is 1 commits behind head on master.
The diff coverage is 66.00%.

❗ Current head 0bed0c9 differs from pull request most recent head 565e4c6. Consider uploading reports for the commit 565e4c6 to get more accurate results

@@            Coverage Diff             @@
##           master    #3592      +/-   ##
==========================================
- Coverage   78.24%   78.22%   -0.03%     
==========================================
  Files         341      341              
  Lines       23098    23129      +31     
==========================================
+ Hits        18073    18092      +19     
- Misses       3674     3683       +9     
- Partials     1351     1354       +3     
Files Coverage Δ
hydra/fake.go 75.00% <100.00%> (+2.27%) ⬆️
selfservice/flow/registration/handler.go 71.70% <63.04%> (-4.43%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

@hperl hperl left a comment

Choose a reason for hiding this comment

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

LGTM!

@Benehiko Benehiko merged commit 7a47827 into master Oct 30, 2023
@Benehiko Benehiko deleted the fix-oauth-registration branch October 30, 2023 10:42
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.

2 participants