cleaned up channel binding logic, cleaned up SaslCredentials, updated documentation
This commit is contained in:
parent
4a8b405f3b
commit
88ea00baa7
5 changed files with 92 additions and 56 deletions
|
|
@ -30,7 +30,11 @@ impl SaslMechanism for Plain {
|
|||
|
||||
fn from_credentials(credentials: SaslCredentials) -> Result<Plain, String> {
|
||||
if let SaslSecret::Password(password) = credentials.secret {
|
||||
Ok(Plain::new(credentials.username, password))
|
||||
if let Some(username) = credentials.username {
|
||||
Ok(Plain::new(username, password))
|
||||
} else {
|
||||
Err("PLAIN requires a username".to_owned())
|
||||
}
|
||||
} else {
|
||||
Err("PLAIN requires a password".to_owned())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue