Use tracing to log scim entry attribute functions failing due to mismatched types

This commit is contained in:
ToxicMushroom 2025-02-14 04:25:11 +01:00
parent 9538787ef9
commit 503738f34d
No known key found for this signature in database
GPG key ID: 4F381DAA6E8379CB
3 changed files with 11 additions and 9 deletions

1
Cargo.lock generated
View file

@ -3034,6 +3034,7 @@ dependencies = [
"sshkey-attest",
"sshkeys",
"time",
"tracing",
"url",
"urlencoding",
"utoipa",

View file

@ -38,6 +38,7 @@ uuid = { workspace = true, features = ["serde"] }
webauthn-rs-proto = { workspace = true }
sshkey-attest = { workspace = true }
sshkeys = { workspace = true }
tracing = { workspace = true }
[dev-dependencies]
enum-iterator = { workspace = true }

View file

@ -9,6 +9,7 @@ use serde_with::{base64, formats, hex::Hex, serde_as, skip_serializing_none};
use std::collections::{BTreeMap, BTreeSet};
use time::format_description::well_known::Rfc3339;
use time::OffsetDateTime;
use tracing::debug;
use url::Url;
use utoipa::ToSchema;
use uuid::Uuid;
@ -261,9 +262,8 @@ impl ScimEntryKanidm {
pub fn attr_str(&self, attr: &Attribute) -> Option<&str> {
match self.attrs.get(attr) {
Some(ScimValueKanidm::String(inner_string)) => Some(inner_string.as_str()),
Some(_sv) => {
// TODO: decide if these log statements should begone or if we add a logging dependency to proto
// debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::String type, actual: {:?}", attr, sv);
Some(sv) => {
debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::String type, actual: {:?}", attr, sv);
None
}
None => None,
@ -273,8 +273,8 @@ impl ScimEntryKanidm {
pub fn attr_bool(&self, attr: &Attribute) -> Option<&bool> {
match self.attrs.get(attr) {
Some(ScimValueKanidm::Bool(inner_bool)) => Some(inner_bool),
Some(_sv) => {
// debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::Bool type, actual: {:?}", attr, sv);
Some(sv) => {
debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::Bool type, actual: {:?}", attr, sv);
None
}
None => None,
@ -284,8 +284,8 @@ impl ScimEntryKanidm {
pub fn attr_mails(&self) -> Option<&Vec<ScimMail>> {
match self.attrs.get(&Attribute::Mail) {
Some(ScimValueKanidm::Mail(inner_string)) => Some(inner_string),
Some(_sv) => {
// debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::Mail type, actual: {:?}", Attribute::Mail, sv);
Some(sv) => {
debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::Mail type, actual: {:?}", Attribute::Mail, sv);
None
}
None => None,
@ -295,8 +295,8 @@ impl ScimEntryKanidm {
pub fn attr_references(&self, attr: &Attribute) -> Option<&Vec<ScimReference>> {
match self.attrs.get(attr) {
Some(ScimValueKanidm::EntryReferences(refs)) => Some(refs),
Some(_sv) => {
// debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::EntryReferences type, actual: {:?}", attr, sv);
Some(sv) => {
debug!("SCIM entry had the {} attribute but it was not a ScimValueKanidm::EntryReferences type, actual: {:?}", attr, sv);
None
}
None => None,