[control] Mark's UI decisions: Remote-Name shown with the proof, [ui] logout_url for Sign out, openssl signing files for the manual intermediate step, engine.not_ready, server sentences for the eight generic codes

This commit is contained in:
2026-11-07 23:48:43 +01:00
parent 3e326e85a0
commit 9933f55242
11 changed files with 225 additions and 13 deletions
+15 -4
View File
@@ -352,7 +352,8 @@ enum UiIdentity {
Forged,
/// The right proof but no usable `Remote-User`.
NoUser,
User(String),
/// The Authelia user name, and the name to show (`Remote-Name` when it is usable).
User(String, String),
}
fn ui_identity(ctl: &Control, headers: &HeaderMap) -> UiIdentity {
@@ -376,7 +377,16 @@ fn ui_identity(ctl: &Control, headers: &HeaderMap) -> UiIdentity {
&& u.len() <= 64
&& u.bytes().all(|c| c.is_ascii_graphic() && c != b':') =>
{
UiIdentity::User(u.to_owned())
let display = headers
.get("remote-name")
.and_then(|v| v.to_str().ok())
.map(str::trim)
.filter(|n| {
!n.is_empty() && n.chars().count() <= 64 && !n.chars().any(char::is_control)
})
.unwrap_or(u)
.to_owned();
UiIdentity::User(u.to_owned(), display)
}
_ => UiIdentity::NoUser,
},
@@ -434,7 +444,7 @@ async fn guard(State(st): State<Arc<AppState>>, mut req: Request, next: Next) ->
Params::new(),
));
}
UiIdentity::User(user) => {
UiIdentity::User(user, display) => {
// Cookie-based sign-in: every write carries the UI header, browser or not.
if write && !ui {
return Err(ApiError::new(
@@ -450,7 +460,7 @@ async fn guard(State(st): State<Arc<AppState>>, mut req: Request, next: Next) ->
})?;
req.extensions_mut().insert(Actor {
token_id: format!("user:{user}"),
name: user,
name: display,
});
return Ok(next.run(req).await);
}
@@ -601,6 +611,7 @@ pub fn router(st: Arc<AppState>) -> Router {
get(pki::get_request).delete(pki::cancel_request),
)
.route("/api/v1/pki-requests/{id}/csr", get(pki::get_csr))
.route("/api/v1/pki-requests/{id}/ext", get(pki::get_ext))
.route(
"/api/v1/pki-requests/{id}/certificate",
axum::routing::put(pki::put_certificate),