pub async fn check_auth(
auth: &Option<Arc<AuthState>>,
headers: &HeaderMap,
) -> Result<(), StatusCode>Expand description
Check authentication for a protected endpoint.
Returns Ok(()) if auth is not configured (open mode), or if a valid
token is present. Returns Err(StatusCode::UNAUTHORIZED) if auth is
configured but no valid token is found.
Token sources (in order):
Authorization: Bearer <token>headertrustee_token=<token>cookie
Dev mode tokens use the format dev:email:name:username.