Skip to main content

write_unauthorized

Function write_unauthorized 

Source
pub async fn write_unauthorized(
    ctx: &mut dyn IHttpContext,
    detail: impl Into<String>,
)
Expand description

Write the single 401 response of the framework.

This is the only place a 401 is produced: every caller (declarative authorization, dynamic authorization, JWT middleware, identity binding) funnels its Error::Unauthorized through here, so the status, the application/problem+json body and the WWW-Authenticate challenge stay consistent.