mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-17 05:05:03 +01:00
things
This commit is contained in:
parent
89820b06ca
commit
606438f301
14 changed files with 173 additions and 114 deletions
|
|
@ -2,7 +2,8 @@
|
|||
//!
|
||||
//! Currently only supports PLAIN (see [RFC 4616](https://datatracker.ietf.org/doc/html/rfc4616))
|
||||
|
||||
use crate::error::{ConException, Result};
|
||||
use crate::error::Result;
|
||||
use amqp_core::error::ConException;
|
||||
|
||||
pub struct PlainUser {
|
||||
pub authorization_identity: String,
|
||||
|
|
@ -13,17 +14,11 @@ pub struct PlainUser {
|
|||
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.into_trans()));
|
||||
.map(|bytes| String::from_utf8(bytes.into()).map_err(|_| ConException::Todo));
|
||||
|
||||
let authorization_identity = parts
|
||||
.next()
|
||||
.ok_or_else(|| ConException::Todo.into_trans())??;
|
||||
let authentication_identity = parts
|
||||
.next()
|
||||
.ok_or_else(|| ConException::Todo.into_trans())??;
|
||||
let password = parts
|
||||
.next()
|
||||
.ok_or_else(|| ConException::Todo.into_trans())??;
|
||||
let authorization_identity = parts.next().ok_or_else(|| ConException::Todo)??;
|
||||
let authentication_identity = parts.next().ok_or_else(|| ConException::Todo)??;
|
||||
let password = parts.next().ok_or_else(|| ConException::Todo)??;
|
||||
|
||||
Ok(PlainUser {
|
||||
authorization_identity,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue