pub struct UpstreamVerifier<U> { /* private fields */ }Expand description
A CredentialVerifier for people who sign in through upstream, labelled label (such as
“FreeAgent account”). Its credentials are carried and never accepted as bearer tokens, and it
changes every sign-in’s version with generation (pass the bytes that should sign everyone out
when they change, such as the provider’s environment and client id).
Implementations§
Source§impl<U: UpstreamSignIn> UpstreamVerifier<U>
impl<U: UpstreamSignIn> UpstreamVerifier<U>
Sourcepub fn new(label: impl Into<String>, upstream: U) -> Self
pub fn new(label: impl Into<String>, upstream: U) -> Self
People sign in through upstream; label names what they sign in with.
Sourcepub fn with_help(self, help: impl Into<String>) -> Self
pub fn with_help(self, help: impl Into<String>) -> Self
One sentence of help on the sign-in page.
Sourcepub fn with_generation(self, generation: impl Into<Vec<u8>>) -> Self
pub fn with_generation(self, generation: impl Into<Vec<u8>>) -> Self
Bytes that sign everyone out when they change. See
CredentialVerifier::generation.
Trait Implementations§
Source§impl<U: UpstreamSignIn> CredentialVerifier for UpstreamVerifier<U>
impl<U: UpstreamSignIn> CredentialVerifier for UpstreamVerifier<U>
Source§fn check<'a>(&'a self, _credential: &'a str) -> CheckFuture<'a>
fn check<'a>(&'a self, _credential: &'a str) -> CheckFuture<'a>
Never asked: nothing is typed, and bearer credentials are not accepted.
Source§fn label(&self) -> &str
fn label(&self) -> &str
The credential’s name in lower case, as it reads in a sentence and on the sign-in page,
e.g. “password” or “Companies House API key”. It also tells verifiers apart in the
sign-in version, so changing it signs everyone out.
Source§fn help(&self) -> &str
fn help(&self) -> &str
One sentence of help under the field, plain text: what it is and where to get one.
Source§fn accepts_bearer(&self) -> bool
fn accepts_bearer(&self) -> bool
Whether a client may send the credential itself as its bearer token instead of signing in
with OAuth. Defaults to
carried.Source§fn generation(&self) -> &[u8] ⓘ
fn generation(&self) -> &[u8] ⓘ
Bytes that change whenever every earlier sign-in should end, such as a hash of the
password, or a new upstream service or environment. Tokens carry a keyed hash of them and
of
label, so a change to either signs everyone out. Defaults to none.Source§fn upstream(&self) -> Option<&dyn UpstreamSignIn>
fn upstream(&self) -> Option<&dyn UpstreamSignIn>
The upstream OAuth provider people sign in through instead of typing a credential, if
any: the sign-in page then sends them to the provider, and the credential it grants is
sealed into their tokens. Defaults to
None. UpstreamVerifier
builds a verifier around one; see crate::upstream.Source§fn prepare<'a>(&self, entered: &'a str) -> &'a str
fn prepare<'a>(&self, entered: &'a str) -> &'a str
Turns what was typed on the sign-in page into the credential to check. Defaults to
trimming surrounding whitespace, which pasted keys often carry; a password keeps it.
Source§fn plausible(&self, credential: &str) -> bool
fn plausible(&self, credential: &str) -> bool
Whether
credential has the shape of one, checked before anything else. Defaults to
plausible; narrow it when the upstream service’s credentials have a known form, so
other tokens are refused locally instead of being forwarded. Implausible input is refused
without counting as a failed attempt.Source§fn carried(&self) -> bool
fn carried(&self) -> bool
Whether the credential is the person’s own key to the upstream service: sealed into their
tokens and handed to tools as a
Credential. false for a password that only proves
who may sign in. Defaults to true.Source§fn subject(&self, credential: &str) -> Option<String>
fn subject(&self, credential: &str) -> Option<String>
Who signed in with
credential: the sub of their tokens, the audit log’s subject and a
Caller’s subject. It must not reveal the credential, and is
readable by anyone who sees a token or a log line. Defaults to None, which lets the
server name them: key: and 16 hex digits of a hash of the credential keyed by
OAUTH_SIGNING_KEY when credentials are carried (one subject per person), and owner
otherwise.Auto Trait Implementations§
impl<U> Forget for UpstreamVerifier<U>
impl<U> Freeze for UpstreamVerifier<U>where
U: Freeze,
impl<U> RefUnwindSafe for UpstreamVerifier<U>where
U: RefUnwindSafe,
impl<U> Send for UpstreamVerifier<U>where
U: Send,
impl<U> Sync for UpstreamVerifier<U>where
U: Sync,
impl<U> Unpin for UpstreamVerifier<U>where
U: Unpin,
impl<U> UnsafeUnpin for UpstreamVerifier<U>where
U: UnsafeUnpin,
impl<U> UnwindSafe for UpstreamVerifier<U>where
U: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more