pub struct SyncScramServer<S: ScramHashing, A: ScramAuthServer<S>, B: ScramCbHelper> { /* private fields */ }
Expand description
§A Scram Server
S: ScramHashing is picked by the program which will use this crate.
This library does not handle manually SCRAM types, so the developer
should manually parse the requested type i.e SCRAM-SHA-256 and
prepeare the instance correctly.
A: ScramAuthServer is a callback trait for authentification. Developer
must attach the ScramAuthServer trait to his authentification
implementation.
If client picks SCRAM-SHA-<any>-PLUS then the developer should
also provide the data_chanbind argument with the server
certificate endpoint i.e native_tls::TlsStream::tls_server_end_point()
Implementations§
Source§impl<'ss, S: ScramHashing + 'ss, A: ScramAuthServer<S> + 'ss, B: ScramCbHelper + 'ss> SyncScramServer<S, A, B>
impl<'ss, S: ScramHashing + 'ss, A: ScramAuthServer<S> + 'ss, B: ScramCbHelper + 'ss> SyncScramServer<S, A, B>
Sourcepub fn make_dyn(self) -> Box<dyn ScramServerDyn + 'ss>
pub fn make_dyn(self) -> Box<dyn ScramServerDyn + 'ss>
Consumes the instance converting it into the ScramServerDyn. So this instance can be stored in the vector.
But, in this case it is required to initialize the instance with the consumed instances, otherwise it will be limited by ’ss lifetime.
Source§impl<S: ScramHashing, A: ScramAuthServer<S>, B: ScramCbHelper> SyncScramServer<S, A, B>
impl<S: ScramHashing, A: ScramAuthServer<S>, B: ScramCbHelper> SyncScramServer<S, A, B>
Sourcepub fn new(
scram_auth_serv: A,
chan_bind_helper: B,
scram_nonce: ScramNonce,
st: &'static ScramType,
ignore_exts: bool,
) -> ScramResult<SyncScramServer<S, A, B>>
pub fn new( scram_auth_serv: A, chan_bind_helper: B, scram_nonce: ScramNonce, st: &'static ScramType, ignore_exts: bool, ) -> ScramResult<SyncScramServer<S, A, B>>
Creates new instance of the SyncScramServer by borrowing the
scram_auth_serv
and chan_bind_helper
with lifetime ’ss.
§Arguments
-
scram_auth_serv
- A reference to the instance which implements ScramAuthServer -
data_chanbind
- A channel binding data TLS Endpoint Cert Hash -
chan_bind_helper
- An implemented trait ScramCbHelper which should provide crate with all necessary data for channel bind. -
scram_nonce
- A Scram Nonce type -
st
- A type of the scram picked by name from table super::scram_common::SCRAM_TYPES -
ignore_exts
- if set to true ignores the additional data which may appear after the protocol data (i.e extensions which are not supported). If set to false generates an error if any unknown data presents after expected data.
§Examples
let serv = AuthServer::new();
let nonce = ScramNonce::Base64(server_nonce);
let scramtype = ScramCommon::get_scramtype("SCRAM-SHA-256").unwrap();
let scram_res = ScramServer::<ScramSha256, AuthServer, AuthServer>::new(&serv, &serv, nonce, scramtype, false);
Trait Implementations§
Source§impl<S: Debug + ScramHashing, A: Debug + ScramAuthServer<S>, B: Debug + ScramCbHelper> Debug for SyncScramServer<S, A, B>
impl<S: Debug + ScramHashing, A: Debug + ScramAuthServer<S>, B: Debug + ScramCbHelper> Debug for SyncScramServer<S, A, B>
Source§impl<S: ScramHashing, A: ScramAuthServer<S>, B: ScramCbHelper> ScramServerDyn for SyncScramServer<S, A, B>
impl<S: ScramHashing, A: ScramAuthServer<S>, B: ScramCbHelper> ScramServerDyn for SyncScramServer<S, A, B>
Source§fn get_auth_username(&self) -> Option<&String>
fn get_auth_username(&self) -> Option<&String>
Source§fn get_auth_authzid(&self) -> Option<&String>
fn get_auth_authzid(&self) -> Option<&String>
Source§fn parse_response_base64(&mut self, input: &[u8]) -> ScramResultServer
fn parse_response_base64(&mut self, input: &[u8]) -> ScramResultServer
Decodes the input from base64 and performes parsing and result computation.
§Arguments
input
- A response from client.
§Returns
- The ScramResultServer is returned with the result.
Source§fn parse_response(&mut self, resp: &str) -> ScramResultServer
fn parse_response(&mut self, resp: &str) -> ScramResultServer
Performes parsing of the response from client and result computation.
It is assumed that resp is UTF-8 valid sequences
§Arguments
-
resp
- A response from client as ref str. -
to_base
- if set to true, will encode response into base64.
§Returns
- The ScramResultServer is returned with the result.