-
Notifications
You must be signed in to change notification settings - Fork 68
feat(core): add OAuth2 consent flow support #584
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
base: main
Are you sure you want to change the base?
Conversation
|
|
@Jorgagu is attempting to deploy a commit to the ory Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #584 +/- ##
===========================================
+ Coverage 42.43% 55.68% +13.25%
===========================================
Files 136 178 +42
Lines 2008 3369 +1361
Branches 288 494 +206
===========================================
+ Hits 852 1876 +1024
- Misses 1149 1416 +267
- Partials 7 77 +70
🚀 New features to boost your workflow:
|
|
@vinckr @jonas-jonas @aeneasr Happy New Year ! 🎉 Could you please review this one ? |
|
hi @Jorgagu, thank you very much for this contribution, and happy new year! We'll take a look at this in the coming weeks. We do have some code for this already; it just wasn't ready to be published, so we might need to do some merging with that. And just a heads-up, we're quite busy ramping up after the holidays again, so it might take a couple days longer for us to get to this. |
|
👋 Hi, I'm an automated AI code review bot. I ran some checks on this PR and found 1 point that might be worth attention (could be false positives, please use your judgment):
If you find these suggestions disruptive, you can reply "stop" , and I'll automatically skip this repository in the future. |
- Add getConsentFlow, acceptConsentRequest, rejectConsentRequest in @ory/nextjs - Add consent page and API routes for app-router, pages-router, custom-components - Display OAuth2 client logo and subtitle on login/registration cards - Add ConsentFooter and custom scope checkbox for custom-components example - Export getConsentNodeKey, isFooterNode, isUiNodeInput, UiNodeInput utilities - Optimize rewriteUrls to single-pass replacement with OAuth2 path exclusion - Add null/undefined handling in rewriteJsonResponse - Add unit tests for consent utilities, card-consent functions, and rewrite
…consent flows Add shared utility getConfigWithOAuth2Logo to override project logo with OAuth2 client logo when available. Apply to Login, Registration, and Consent flows to display the OAuth2 client's logo during OAuth2-initiated flows.
75d637e to
70b3e84
Compare
Add security validation to prevent consent hijacking attacks where an attacker could use a stolen consent_challenge to grant or reject consent on behalf of a different user. Changes: - Pages Router: verify session cookie and compare identity with subject - App Router: add identityId parameter to accept/reject functions - Return 401 for missing session, 403 for identity mismatch
70b3e84 to
73020fc
Compare
Add complete OAuth2 consent flow support to
@ory/nextjsand@ory/elements-reactpackages, enabling applications to handle OAuth2 authorization consent screens with Ory Hydra.Related Issue or Design Document
Fixex #327
Add complete OAuth2 consent flow support to
@ory/nextjsand@ory/elements-reactpackages, enabling applications to handle OAuth2 authorization consent screens with Ory Hydra.Features
Consent Flow Utilities (
@ory/nextjs)getConsentFlow- Fetch consent challenge from Ory HydraacceptConsentRequest- Accept consent with selected scopesrejectConsentRequest- Reject consent requestOAuth2 Client Logo Display
getConfigWithOAuth2Logoutility for consistent behaviorExample Implementations
Exported Utilities
getConsentNodeKey,isFooterNodefrom card-consentisUiNodeInput,UiNodeInputtype helpersImprovements
rewriteUrlsto single-pass regex replacementrewriteJsonResponseTests
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
Further comments
This implementation follows the pattern established in kratos-selfservice-ui-node for handling OAuth2 flows. The OAuth2 client logo is displayed by overriding the project configuration's
logo_light_urlwhen an OAuth2 client logo is available, keeping the existingDefaultCardLogocomponent unchanged.