pub trait Authenticator: NextBytes {
// Required method
fn auth_scheme(&self) -> &'static str;
// Provided methods
fn http_incoming_auth<'a, R>(
&'a mut self,
get_header: R,
) -> Result<AuthState, Box<dyn Error>>
where R: Fn(&'static str) -> Result<Option<&'a str>, Box<dyn Error>> { ... }
fn http_outgoing_auth<'a, F>(
&'a mut self,
get_header: F,
) -> Result<AuthState, Box<dyn Error>>
where F: Fn(&'static str) -> Result<Vec<&'a str>, Box<dyn Error>> { ... }
}Expand description
An authenticator that can authenticate incoming requests for servers
Required Methods§
Sourcefn auth_scheme(&self) -> &'static str
fn auth_scheme(&self) -> &'static str
HTTP auth schemes, as defined in RFC7235
Provided Methods§
Sourcefn http_incoming_auth<'a, R>(
&'a mut self,
get_header: R,
) -> Result<AuthState, Box<dyn Error>>
fn http_incoming_auth<'a, R>( &'a mut self, get_header: R, ) -> Result<AuthState, Box<dyn Error>>
Performs authentication against a received request from the client. If authentication is incomplete, the caller is instructed through AuthState::Response to send the http response contained in AuthState::Response (401) to the client. After a full authentication attempt, do not call this method on the same Authenticator instance again.
Sourcefn http_outgoing_auth<'a, F>(
&'a mut self,
get_header: F,
) -> Result<AuthState, Box<dyn Error>>
fn http_outgoing_auth<'a, F>( &'a mut self, get_header: F, ) -> Result<AuthState, Box<dyn Error>>
Provide an authentication state so the caller can retry an outgoing request until the server has all needed authentication information. If authentication is incomplete, the caller is instructed through AuthState::Response to retry the http request to the server with the headers contained in AuthState::Response. After a full authentication attempt, do not call this method on the same Authenticator instance again.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.