pub(crate) fn client_auth_info<'a>(
        &self,
        credential: &'a Credential,
    ) -> Result<ClientAuthInfo<'a>> {
        let username = credential
            .username
            .as_ref()
            .ok_or_else(|| Error::authentication_error("SCRAM", "no username supplied"))?;

        let password = credential
            .password
            .as_ref()
            .ok_or_else(|| Error::authentication_error("SCRAM", "no password supplied"))?;

        let source = match credential.source.as_ref() {
            Some(s) => s.as_str(),
            None => "admin",
        };

        if credential.mechanism_properties.is_some() {
            return Err(Error::authentication_error(
                "SCRAM",
                "mechanism properties MUST NOT be specified",
            ));
        };

        Ok(ClientAuthInfo {
            username,
            password,
            source,
        })
    }
/// Derives the authentication info from a credential.
Derives the authentication info from a credential.
Derives the authentication info from a credential .
pub(crate) fn client_auth_info<'a>(
        &self,
        credential: &'a Credential,
    ) -> Result<ClientAuthInfo<'a>> {
        let username = credential
            .username
            .as_ref()
            .ok_or_else(|| Error::authentication_error("SCRAM", "no username supplied"))?;
        let password = credential
            .password
            .as_ref()
            .ok_or_else(|| Error::authentication_error("SCRAM", "no password supplied"))?;
        let source = match credential.source.as_ref() {
            Some(s) => s.as_str(),
            None => "admin",
        };
        if credential.mechanism_properties.is_some() {
            return Err(Error::authentication_error(
                "SCRAM",
                "mechanism properties MUST NOT be specified",
            ));
        };
        Ok(ClientAuthInfo {
            username,
            password,
            source,
        })
    }
pub ( crate ) fn client_auth_info < ' a > ( & self , credential : & ' a Credential , ) -> Result < ClientAuthInfo < ' a > > { let username = credential . username . as_ref ( ) . ok_or_else ( | | Error :: authentication_error ( " " , " " ) ) ? ; let password = credential . password . as_ref ( ) . ok_or_else ( | | Error :: authentication_error ( " " , " " ) ) ? ; let source = match credential . source . as_ref ( ) { Some ( s ) => s . as_str ( ) , None => " " , } ; if credential . mechanism_properties . is_some ( ) { return Err ( Error :: authentication_error ( " " , " " , ) ) ; } ; Ok ( ClientAuthInfo { username , password , source , } ) }
Derives the authentication info from a credential.
Derives the authentication info from a credential .
&self
credential
&'a Credential
&self
credential
&'a Credential