pub struct DoorAuth { /* private fields */ }Expand description
One session’s door key and the tokens minted with it, and — for a formation member — what its door checks a formation token with.
Implementations§
Source§impl DoorAuth
impl DoorAuth
Sourcepub fn mint(authentication: &NetworkAuthentication) -> Result<Self, String>
pub fn mint(authentication: &NetworkAuthentication) -> Result<Self, String>
Generates this session’s key and mints the operator token, holding every scope in
DOOR_SCOPES, and one token per declared credential with exactly its scopes.
The Err is the operating system refusing randomness, and carries no key material.
Sourcepub fn with_formation(self, verifier: FormationVerifier) -> Self
pub fn with_formation(self, verifier: FormationVerifier) -> Self
This door, also taking formation tokens issued to the member verifier names.
Sourcepub fn operator_token(&self) -> &DoorToken
pub fn operator_token(&self) -> &DoorToken
The token holding every scope.
Sourcepub fn tokens(&self) -> &[(String, DoorToken)]
pub fn tokens(&self) -> &[(String, DoorToken)]
Every token this session minted, operator first, then the declared credentials by name.
Sourcepub fn verify(
&self,
authorization_headers: &[&str],
) -> Result<DoorGrant, AuthRefusal>
pub fn verify( &self, authorization_headers: &[&str], ) -> Result<DoorGrant, AuthRefusal>
The grant authorization_headers present: every Authorization header value on the
request, as sent.
No header is AuthRefusal::Missing. More than one, a scheme other than Bearer, a token
this key did not seal, and a payload naming a scope outside DOOR_SCOPES are all
AuthRefusal::Invalid, indistinguishably. So is a formation token that does not verify,
and every formation token at a door with no verifier. A genuine formation token issued for
another door is AuthRefusal::NotPermitted.
Trait Implementations§
Auto Trait Implementations§
impl Forget for DoorAuth
impl Freeze for DoorAuth
impl Move for DoorAuth
impl RefUnwindSafe for DoorAuth
impl Send for DoorAuth
impl Sync for DoorAuth
impl Unpin for DoorAuth
impl UnsafeUnpin for DoorAuth
impl UnwindSafe for DoorAuth
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
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> ⓘ
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> ⓘ
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