update identity detection methods

This commit is contained in:
yggverse 2025-01-23 13:28:18 +02:00
parent 9a7984f345
commit d7f6e2f16b
8 changed files with 47 additions and 41 deletions

View file

@ -164,7 +164,7 @@ fn handle(
.page
.profile
.identity
.match_scope(&uri.to_string())
.get(&uri.to_string())
{
Some(identity) => match identity.to_tls_certificate() {
Ok(certificate) => Some(certificate),

View file

@ -43,19 +43,16 @@ impl Default {
Value::ProfileIdentityId(value) => Some(value),
Value::GuestSession => None,
Value::GeneratePem => Some(
match profile
profile
.identity
.make(None, &widget.form.name.value().unwrap())
{
Ok(profile_identity_id) => profile_identity_id,
Err(e) => todo!("{e}"),
},
.unwrap(), // @TODO handle
),
Value::ImportPem => Some(
match profile.identity.add(&widget.form.file.pem.take().unwrap()) {
Ok(profile_identity_id) => profile_identity_id,
Err(e) => todo!("{e}"),
},
profile
.identity
.add(&widget.form.file.pem.take().unwrap())
.unwrap(), // @TODO handle
),
};
@ -63,19 +60,20 @@ impl Default {
match option {
// Activate identity for `scope`
Some(profile_identity_id) => {
if let Err(e) = profile
if profile
.identity
.auth
.apply(profile_identity_id, &request.to_string())
.is_err()
{
todo!("{e}")
};
panic!() // unexpected @TODO
}
}
// Remove all identity auths for `scope`
None => {
if let Err(e) = profile.identity.auth.remove_scope(&request.to_string()) {
todo!("{e}")
};
if profile.identity.auth.remove(&request.to_string()).is_err() {
panic!() // unexpected @TODO
}
}
}

View file

@ -111,9 +111,7 @@ impl Form {
self.profile
.identity
.auth
.memory
.match_scope(&self.request.to_string())
.is_some_and(|auth| auth.profile_identity_id == profile_identity_id),
.is_matches(&self.request.to_string(), profile_identity_id),
);
self.save.update(true);
}

View file

@ -9,7 +9,5 @@ pub fn new_for_profile_identity_id(
profile
.identity
.auth
.memory
.match_scope(auth_url)
.is_some_and(|auth| auth.profile_identity_id == profile_identity_id)
.is_matches(auth_url, profile_identity_id) // @TODO direct call?
}

View file

@ -77,7 +77,7 @@ impl Navigation {
self.history.update();
self.reload.update(!request.is_empty());
self.request
.update(self.profile.identity.match_scope(&request).is_some());
.update(self.profile.identity.get(&request).is_some());
self.home.update();
}