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

refactor(oidc): allow passing a Prompt to get an OIDC url #4131

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

jmartinesp
Copy link
Contributor

@jmartinesp jmartinesp commented Oct 16, 2024

This allows clients to directly open the web page they want: the login one, the registration one, consent, etc. It should improve the UX in the registration flow since we can now skip the login one.

Requested in element-hq/element-x-android#3635.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@jmartinesp jmartinesp requested a review from a team as a code owner October 16, 2024 08:20
@jmartinesp jmartinesp requested review from stefanceriu and removed request for a team October 16, 2024 08:20
@jmartinesp jmartinesp force-pushed the misc/add-oidc-prompt-parameter-for-url-for-oidc-login branch from 3294bd0 to 2386ff2 Compare October 16, 2024 08:22
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

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

Very nice! 👏

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.62%. Comparing base (ee4ef2e) to head (a83a630).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4131      +/-   ##
==========================================
- Coverage   84.72%   84.62%   -0.11%     
==========================================
  Files         269      269              
  Lines       28837    28831       -6     
==========================================
- Hits        24432    24398      -34     
- Misses       4405     4433      +28     

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

Changelog: `Client::url_for_oidc_login` is now `Client::url_for_oidc` with an additional `OidcPrompt` parameter. `abort_oidc_login` has been renamed to `abort_oidc_auth`.

This allows clients to directly open the web page they want: the login one, the registration one, consent, etc. It should improve the UX in the registration flow since we can now skip the login one.
@jmartinesp jmartinesp force-pushed the misc/add-oidc-prompt-parameter-for-url-for-oidc-login branch from 1959558 to a83a630 Compare October 16, 2024 09:04
@jmartinesp jmartinesp enabled auto-merge (rebase) October 16, 2024 09:04
Unknown { value: String },
}

impl From<OidcPrompt> for SdkOidcPrompt {
Copy link
Member

Choose a reason for hiding this comment

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

Consider annotating the SdkOidcPrompt with the uniffi derive in place of adding the wrapper, since the wrapper seems completely equivalent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prompt comes from an external crate, so I think there's no way to export it? Also, the enum uses the Case(value) form, which is not allowed by uniffi 🫤 .

Copy link
Member

Choose a reason for hiding this comment

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

oh i see, so SdkOidcPrompt is a preexisting dubious name, but oh well. Nevermind me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's true the name makes you think the type comes from the SDK... I can rename it to something better in another PR, but nothing came to mind. OAuth2OidcPrompt? Should I just use the full oauth2types::requests::Prompt form?

Copy link
Member

Choose a reason for hiding this comment

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

Do not fret too much about it, sorry, this was more a light remark at the existing code. But yeah using the fully-qualified type would look great here!

@bnjbvr bnjbvr disabled auto-merge October 16, 2024 09:18
@bnjbvr bnjbvr merged commit 79798a9 into main Oct 16, 2024
40 checks passed
@bnjbvr bnjbvr deleted the misc/add-oidc-prompt-parameter-for-url-for-oidc-login branch October 16, 2024 09:28
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.

3 participants