Use Box to store UserID and DeviceID

Userid and DeviceID are of unknown size, use Box to be able to store
them into the userdevicesessionid_uiaarequest BTreeMap
This commit is contained in:
Moritz Bitsch 2021-12-22 19:26:23 +01:00
parent 720a54b3bb
commit c4a438460e

View file

@ -21,7 +21,7 @@ use super::abstraction::Tree;
pub struct Uiaa {
pub(super) userdevicesessionid_uiaainfo: Arc<dyn Tree>, // User-interactive authentication
pub(super) userdevicesessionid_uiaarequest:
RwLock<BTreeMap<(String, String, String), CanonicalJsonValue>>,
RwLock<BTreeMap<(Box<UserId>, Box<DeviceId>, String), CanonicalJsonValue>>,
}
impl Uiaa {
@ -155,8 +155,8 @@ impl Uiaa {
.unwrap()
.insert(
(
user_id.to_string(),
device_id.to_string(),
user_id.to_owned(),
device_id.to_owned(),
session.to_string(),
),
request.to_owned(),
@ -176,8 +176,8 @@ impl Uiaa {
.read()
.unwrap()
.get(&(
user_id.to_string(),
device_id.to_string(),
user_id.to_owned(),
device_id.to_owned(),
session.to_string(),
))
.map(|j| j.to_owned()))