Skip to content

Commit b58344f

Browse files
committed
Forward the login_hint upstream.
1 parent f527c17 commit b58344f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1+
# Rust
12
target/
3+
4+
# Editors
5+
.idea
6+
.nova
7+
8+
# OS garbage
9+
.DS_Store

crates/handlers/src/upstream_oauth2/authorize.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use hyper::StatusCode;
1212
use mas_axum_utils::{cookies::CookieJar, record_error};
1313
use mas_data_model::UpstreamOAuthProvider;
1414
use mas_oidc_client::requests::authorization_code::AuthorizationRequestData;
15-
use mas_router::UrlBuilder;
15+
use mas_router::{PostAuthAction, UrlBuilder};
1616
use mas_storage::{
1717
BoxClock, BoxRepository, BoxRng,
1818
upstream_oauth2::{UpstreamOAuthProviderRepository, UpstreamOAuthSessionRepository},
@@ -92,6 +92,15 @@ pub(crate) async fn get(
9292
data = data.with_response_mode(response_mode.into());
9393
}
9494

95+
// Forward the raw login hint upstream for the provider to handle however it sees fit
96+
if let Some(post_auth_action) = &query.post_auth_action {
97+
if let PostAuthAction::ContinueAuthorizationGrant { id } = post_auth_action {
98+
if let Some(grant) = repo.oauth2_authorization_grant().lookup(*id).await? {
99+
data.login_hint = grant.login_hint;
100+
}
101+
}
102+
}
103+
95104
let data = if let Some(methods) = lazy_metadata.pkce_methods().await? {
96105
data.with_code_challenge_methods_supported(methods)
97106
} else {

0 commit comments

Comments
 (0)