pub struct SharedSecretInternalAuthenticator { /* private fields */ }Expand description
A platform-plane authenticator backed by a single pre-shared secret.
See the module docs for when this is (and is not) appropriate.
Implementations§
Sourcepub fn try_new(
secret: SecretString,
peer_name: String,
) -> Result<Self, InvalidSharedSecret>
pub fn try_new( secret: SecretString, peer_name: String, ) -> Result<Self, InvalidSharedSecret>
Build an authenticator that accepts exactly secret and resolves valid
callers to PlatformIdentity::Shared with the label peer_name.
§Errors
Returns InvalidSharedSecret if the secret is empty or is the
REDACTED_PLACEHOLDER. An empty secret is the dangerous one: the
comparison in InternalAuthenticator::authenticate is over bytes, and
an empty secret matches an empty token — so anyone sending the internal
header with no value would authenticate as peer_name.
Trait Implementations§
Source§fn clone(&self) -> SharedSecretInternalAuthenticator
fn clone(&self) -> SharedSecretInternalAuthenticator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§async fn authenticate(
&self,
token: &str,
) -> Result<PlatformIdentity, InternalAuthNError>
async fn authenticate( &self, token: &str, ) -> Result<PlatformIdentity, InternalAuthNError>
Authenticate the raw
X-ToolKit-Internal-Token value and resolve the
caller’s PlatformIdentity. Read moreAuto Trait Implementations§
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