Skip to content
Open
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
11 changes: 11 additions & 0 deletions rust/operator-binary/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ fn append_oidc_config(
let well_known_config_url = oidc
.well_known_config_url()
.context(InvalidWellKnownConfigUrlSnafu)?;
let client_auth_method = serde_json::to_value(
client_options.client_authentication_method,
)
.expect("ClientAuthenticationMethod should serialize to JSON");
let client_auth_method = client_auth_method
.as_str()
.expect("ClientAuthenticationMethod should serialize to a string");

formatdoc!(
"
{{ 'name': 'keycloak',
Expand All @@ -257,6 +265,7 @@ fn append_oidc_config(
}},
'api_base_url': '{api_base_url}',
'server_metadata_url': '{well_known_config_url}',
'token_endpoint_auth_method': '{client_auth_method}',
}},
}}",
scopes = scopes.join(" "),
Expand Down Expand Up @@ -340,6 +349,7 @@ mod tests {
let oidc = oidc::v1alpha1::ClientAuthenticationOptions {
client_credentials_secret_ref: "nifi-keycloak-client".to_owned(),
extra_scopes: vec![],
client_authentication_method: Default::default(),
product_specific_fields: (),
};

Expand All @@ -357,6 +367,7 @@ mod tests {
assert!(oauth_providers.contains("client_id': os.environ.get("));
assert!(oauth_providers.contains("client_secret': os.environ.get("));
assert!(oauth_providers.contains("'scope': 'openid'"));
assert!(oauth_providers.contains("'token_endpoint_auth_method': 'client_secret_basic'"));
assert!(oauth_providers.contains(&format!("'api_base_url': '{expected_api_base_url}'")));
assert!(oauth_providers.contains(&format!(
"'server_metadata_url': '{expected_server_metadata_url}'"
Expand Down
2 changes: 2 additions & 0 deletions rust/operator-binary/src/crd/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ mod tests {
client_auth_options: oidc::v1alpha1::ClientAuthenticationOptions {
client_credentials_secret_ref: "superset-oidc-client1".into(),
extra_scopes: vec!["groups".into()],
client_authentication_method: Default::default(),
product_specific_fields: ()
}
},
Expand All @@ -502,6 +503,7 @@ mod tests {
client_auth_options: oidc::v1alpha1::ClientAuthenticationOptions {
client_credentials_secret_ref: "superset-oidc-client2".into(),
extra_scopes: Vec::new(),
client_authentication_method: Default::default(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the field a String? Just curious what the default value is here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

product_specific_fields: ()
}
}
Expand Down
Loading