HTTP: Add redirectRoot option to Http object

This commit is contained in:
Maurus Decimus
2026-06-17 19:30:36 +02:00
parent 8778e1bc45
commit b1880c8670
10 changed files with 45 additions and 21 deletions

View File

@@ -233,24 +233,22 @@ impl OAuthApiHandler for Server {
// Parse and validate PKCE challenge (RFC 7636).
let pkce_challenge = match code_challenge {
Some(challenge) => {
match code_challenge_method.as_deref().unwrap_or("plain") {
"S256" => PkceCodeChallenge::S256(challenge),
"plain" if stateless_client.is_none() => {
PkceCodeChallenge::Plain(challenge)
}
_ => {
return Err(trc::AuthEvent::Error
.into_err()
.details("Unsupported PKCE code_challenge_method."));
}
Some(challenge) => match code_challenge_method.as_deref().unwrap_or("plain") {
"S256" => PkceCodeChallenge::S256(challenge),
"plain" if stateless_client.is_none() => {
PkceCodeChallenge::Plain(challenge)
}
}
None => {
if stateless_client.is_some() {
_ => {
return Err(trc::AuthEvent::Error
.into_err()
.details("A PKCE code_challenge with the S256 method is required."));
.details("Unsupported PKCE code_challenge_method."));
}
},
None => {
if stateless_client.is_some() {
return Err(trc::AuthEvent::Error.into_err().details(
"A PKCE code_challenge with the S256 method is required.",
));
}
PkceCodeChallenge::None
}

View File

@@ -611,6 +611,8 @@ impl ParseHttp for Server {
if path.next().is_none() {
if !external.is_empty() {
return Ok(HttpResponse::redirect(format!("/{external}/")));
} else if let Some(url) = &self.core.network.http.redirect_root {
return Ok(HttpResponse::redirect(url.clone()));
}
} else if let Some(resource) = self
.inner