mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 05:06:53 +00:00
OIDC: make response_mode optional
Fractal omits the `response_mode` field when in an auth flow (its value must be the literal "S256", so it's mainly here for OIDC compliance I guess). Accepting this lets it proceed to the next authentication step.
This commit is contained in:
1 parent
d916bb9f21
commit
95632103bc
2 files changed
+4
-18
No files matched your search
@@ -1,4 +1,3 @@
|
||||
use std::borrow::Cow;
|
||||
use askama::Template;
|
||||
use axum::http::StatusCode;
|
||||
use oxide_auth::frontends::simple::request::Body;
|
||||
@@ -27,11 +26,7 @@ pub fn oidc_consent_form(hostname: &str, query: &AuthorizationQuery) -> OidcResp
|
||||
|
||||
/// Render the html contents of the user consent page.
|
||||
fn consent_page(hostname: &str, query: &AuthorizationQuery, route: &str, nonce: &str) -> String {
|
||||
let response_mode = &query.response_mode.clone()
|
||||
.unwrap_or_else(|| match query.redirect_uri.scheme() {
|
||||
| "https" => Cow::Borrowed("fragment"),
|
||||
| _ => Cow::Borrowed("query")
|
||||
});
|
||||
let response_mode = &query.response_mode.clone().unwrap_or("fragment".to_string());
|
||||
let template = ConsentPageTemplate {
|
||||
nonce,
|
||||
hostname,
|
||||
|
||||
+3
-12
@@ -62,13 +62,9 @@ impl TryFrom<OidcRequest> for LoginQuery {
|
||||
let Ok(redirect_uri) = Url::from_str(&redirect_uri) else {
|
||||
return Err(LoginError("invalid field: redirect_uri".to_owned()));
|
||||
};
|
||||
// response_mode is not strictly needed : its value defaults to "fragment"
|
||||
// response_mode is not strictly needed : it must be the literal "fragment"
|
||||
// when over https. It's required by the spec but Fractal doesn't provide it.
|
||||
let response_mode = body.unique_value("response_mode")
|
||||
.unwrap_or_else(|| match redirect_uri.scheme() {
|
||||
| "https" => Cow::Borrowed("fragment"),
|
||||
| _ => Cow::Borrowed("query")
|
||||
});
|
||||
let response_mode = body.unique_value("response_mode").unwrap_or(Cow::Borrowed("fragment"));
|
||||
let client_secret = body.unique_value("client_secret").map(|s| s.to_string());
|
||||
|
||||
Ok(Self {
|
||||
@@ -108,12 +104,7 @@ pub fn oidc_login_form(hostname: &str, query: &AuthorizationQuery) -> OidcRespon
|
||||
|
||||
/// Render the html contents of the login page.
|
||||
fn login_page(hostname: &str, query: &AuthorizationQuery, route: &str, nonce: &str) -> String {
|
||||
let response_mode = &query.response_mode
|
||||
.clone()
|
||||
.unwrap_or_else(|| match query.redirect_uri.scheme() {
|
||||
| "https" => "fragment".to_string(),
|
||||
| _ => "query".to_string()
|
||||
});
|
||||
let response_mode = &query.response_mode.clone().unwrap_or("fragment".to_string());
|
||||
let template = LoginPageTemplate {
|
||||
nonce,
|
||||
hostname,
|
||||
|
||||
Reference in new issue
Block a user