Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/keystone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ openstack-keystone-core-types = { workspace = true, features = ["mock"] }
openstack-keystone-distributed-storage = { workspace = true, features = ["mock"] }
rstest.workspace = true
secrecy = { workspace = true, features = ["serde"] }
tempfile.workspace = true
tokio = { workspace = true, features = ["process", "macros"] }
tracing-test = { workspace = true, features = ["no-env-filter"] }
url.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions crates/keystone/src/api/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ use crate::keystone::ServiceState;
///
/// # Returns
/// * `Result<Domain, KeystoneApiError>` - The domain object
// Not yet wired into an endpoint (no id-or-name domain lookup route exists
// yet); kept for the domain-scoped auth work it was written for.
#[allow(dead_code)]
pub async fn get_domain<I: AsRef<str>, N: AsRef<str>>(
state: &ServiceState,
id: Option<I>,
Expand Down
8 changes: 4 additions & 4 deletions crates/keystone/src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn sanitize_authentication_error(e: &AuthenticationError) -> &'static str {
AuthenticationError::UserLocked(_) => "UserLocked",
AuthenticationError::UserPasswordExpired(_) => "UserPasswordExpired",
AuthenticationError::Provider { source, .. } => {
extract_provider_name(source).unwrap_or("ProviderError")
extract_provider_name(source.as_ref()).unwrap_or("ProviderError")
}
AuthenticationError::Validation(_) => "ValidationError",
AuthenticationError::StructBuilder { .. } => "StructBuilderError",
Expand Down Expand Up @@ -137,7 +137,7 @@ pub fn sanitize_authentication_error(e: &AuthenticationError) -> &'static str {
/// Guarantees PII in third-party provider errors (emails, tokens) never
/// reaches audit records.
pub fn extract_provider_name(
source: &Box<dyn std::error::Error + Send + Sync>,
source: &(dyn std::error::Error + Send + Sync + 'static),
) -> Option<&'static str> {
if source.is::<IdentityProviderError>() {
Some("Identity")
Expand Down Expand Up @@ -288,7 +288,7 @@ mod tests {
fn extract_provider_name_identity() {
let e: Box<dyn std::error::Error + Send + Sync> =
Box::new(IdentityProviderError::UserNotFound("x".into()));
assert_eq!(extract_provider_name(&e), Some("Identity"));
assert_eq!(extract_provider_name(e.as_ref()), Some("Identity"));
}

#[test]
Expand All @@ -297,7 +297,7 @@ mod tests {
#[error("unknown")]
struct Unknown;
let e: Box<dyn std::error::Error + Send + Sync> = Box::new(Unknown);
assert_eq!(extract_provider_name(&e), None);
assert_eq!(extract_provider_name(e.as_ref()), None);
}

#[test]
Expand Down
Loading
Loading