Module chain
Expand description
The first-success provider chain (ADR 0021 §5, cratestack#1243):
several AuthProviders composed into one, in order.
let auth = first_success(oauth).or(device_signature).or(cose_signer);For each member, in order:
- If its
credentialisCredential::Absent, it is skipped without being called. - If it returns an authenticated context, that is the answer.
- If it returns an error (an
AuthRefusalor any other), that is the answer. A credential one member refuses is never rescued by another: the chain fails closed. - If it returns an anonymous context, the next member is asked.
When no member authenticates, the chain answers with the first anonymous context a member returned (so what a provider put in it, such as its extensions, is kept), or a plain anonymous context when every member was skipped, and the schema’s policies decide. A request that carries two credentials is resolved by order: the first member that authenticates it wins.
The chain is generic and static (Or<Or<A, B>, C>): AuthProvider
returns impl Future and is not object-safe, so there is no dyn list.
Structs§
- First
Success - A first-success chain of
AuthProviders, itself anAuthProvider. Built withfirst_success. - Or
- Two chain members,
firstasked beforenext.
Functions§
- first_
success - Starts a first-success chain with
first; add members withFirstSuccess::or. See the module documentation.