mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-06-11 10:53:19 +02:00
switch to uuid parsing for tokens
This commit is contained in:
@ -235,8 +235,12 @@ impl card_d_e_s_fire_e_v2::Server for User {
|
||||
let card_key = pry!(params.get_auth_key());
|
||||
let token = pry!(params.get_token());
|
||||
|
||||
let token: Cow<'_, str> = if let Ok(url) = std::str::from_utf8(token) {
|
||||
Cow::Borrowed(url)
|
||||
let token: Cow<'_, str> = if let Ok(uuid) = Uuid::from_slice(token) {
|
||||
Cow::Owned(
|
||||
uuid.to_hyphenated()
|
||||
.encode_lower(&mut Uuid::encode_buffer())
|
||||
.to_string(),
|
||||
)
|
||||
} else {
|
||||
Cow::Owned(hex::encode(token))
|
||||
};
|
||||
@ -310,8 +314,12 @@ impl card_d_e_s_fire_e_v2::Server for User {
|
||||
let params = pry!(params.get());
|
||||
let token = pry!(params.get_token());
|
||||
|
||||
let token: Cow<'_, str> = if let Ok(url) = std::str::from_utf8(token) {
|
||||
Cow::Borrowed(url)
|
||||
let token: Cow<'_, str> = if let Ok(uuid) = Uuid::from_slice(token) {
|
||||
Cow::Owned(
|
||||
uuid.to_hyphenated()
|
||||
.encode_lower(&mut Uuid::encode_buffer())
|
||||
.to_string(),
|
||||
)
|
||||
} else {
|
||||
Cow::Owned(hex::encode(token))
|
||||
};
|
||||
|
Reference in New Issue
Block a user