mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-17 05:05:03 +01:00
rename lol
This commit is contained in:
parent
c68cd04af7
commit
543e39f129
70 changed files with 283 additions and 266 deletions
|
|
@ -1,29 +0,0 @@
|
|||
//! (Very) partial implementation of SASL Authentication (see [RFC 4422](https://datatracker.ietf.org/doc/html/rfc4422))
|
||||
//!
|
||||
//! Currently only supports PLAIN (see [RFC 4616](https://datatracker.ietf.org/doc/html/rfc4616))
|
||||
|
||||
use amqp_core::error::ConException;
|
||||
|
||||
use crate::error::Result;
|
||||
|
||||
pub struct PlainUser {
|
||||
pub authorization_identity: String,
|
||||
pub authentication_identity: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
pub fn parse_sasl_plain_response(response: &[u8]) -> Result<PlainUser> {
|
||||
let mut parts = response
|
||||
.split(|&n| n == 0)
|
||||
.map(|bytes| String::from_utf8(bytes.into()).map_err(|_| ConException::Todo));
|
||||
|
||||
let authorization_identity = parts.next().ok_or(ConException::Todo)??;
|
||||
let authentication_identity = parts.next().ok_or(ConException::Todo)??;
|
||||
let password = parts.next().ok_or(ConException::Todo)??;
|
||||
|
||||
Ok(PlainUser {
|
||||
authorization_identity,
|
||||
authentication_identity,
|
||||
password,
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue