pub trait IdentityProvider:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn authenticate(
&self,
credentials: &Credentials,
) -> Result<Option<Principal>, AuthError>;
}Expand description
Turns credentials into a Principal, or declines.
The three-way return is what makes providers composable on a shared system:
Ok(Some(p)) accepts, Ok(None) abstains (these are not my credentials —
let the next provider try), and Err rejects (these look like mine but are
invalid — stop and fail). A provider that abstains on absent credentials lets
an anonymous fallback take over when the surface allows it.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
A short name recorded in Principal::provider and logs.
Sourcefn authenticate(
&self,
credentials: &Credentials,
) -> Result<Option<Principal>, AuthError>
fn authenticate( &self, credentials: &Credentials, ) -> Result<Option<Principal>, AuthError>
Authenticates credentials.
§Errors
Returns AuthError::Unauthenticated when credentials are addressed to
this provider but fail verification.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".