Noir::RustRequestGuards
Which request-guard / extractor types can refuse an anonymous caller,
read off their impl FromRequest for X (Rocket, actix-web) or
impl FromRequestParts<S> for X (axum) definitions instead of their
names.
A type refuses when its impl can answer 401/403 (Status::Unauthorized,
StatusCode::FORBIDDEN, actix ErrorUnauthorized, or a macro_rules!
whose body does, or returns as its error a variant that
fn status_code maps to 401/403: Err(MyError::IncorrectLogin)
/ .ok_or(MyError::IncorrectLogin) after
MyError::IncorrectLogin => StatusCode::UNAUTHORIZED; into_response
and any &self method returning a StatusCode, such as
fn client_status_and_error(&self) -> (StatusCode, ClientError), map
variants the same way, read where the enum is defined: its file when the
guard's file defines it, else its crate), or forwards the
failure of a type that refuses
(try_outcome!(Headers::from_request(req).await), X::from_request_parts(..).await?).
A refusal that only fires when another in-crate guard fails
(let Outcome::Success(ip) = ClientIp::from_request(req).await else { 401 })
counts only if that guard itself refuses, so a wrapper around a guard
that never fails is not a guard.
A redirect to a login page (Redirect::to("/login"), a SEE_OTHER with
a /login location) refuses like a 401.
No file I/O: callers feed source text (and its path) to scan and
combine the results.
Constants
A status or a redirect (any 3xx).
ponytail: fallback when no status mapping in reach decides a variant
(e.g. a Code table behind a macro): the variant's own name says it
refuses the credential. Add real mapping reads when a repo needs more.
Methods whose argument becomes the Err of the value they return.
impl Type, impl crate::Type, impl Type<T>, impl<T> Type<T>.
Both impl patterns are matched anchored at an impl keyword.
Redirect::to("/login"), (header::LOCATION, "/signin"): the target
literal names a login page and carries no error= (an OAuth callback
sending a failed login back is not a refusal of the caller).
An enum path in a match pattern: AppError::NotLoggedIn, NotLoggedIn.
A raw string (r#"say "hi""#) or a char literal ('"', '\'',
'\u{1F600}'), neither of which the C-style stripper can read; not a
lifetime ('a).
Self::auth_token(...): a call to an inherent method of the guard type.
ponytail: a status mapping is read off its signature, not its callers;
a &self -> StatusCode helper nothing calls still maps its variants.
Class methods
Leaf type names of a fn's parameters that are required guards, keyed
by the fn name's 1-based line. Option<X> / Result<X, E> parameters
never refuse the request, so they are left out.
{type => refuses?} for every type whose impls agree.