@@ -235,6 +235,14 @@ fn append_oidc_config(
235235 . well_known_config_url ( )
236236 . context ( InvalidWellKnownConfigUrlSnafu ) ?;
237237
238+ let client_auth_method = serde_json:: to_value (
239+ client_options. client_authentication_method ,
240+ )
241+ . expect ( "ClientAuthenticationMethod should serialize to JSON" ) ;
242+ let client_auth_method = client_auth_method
243+ . as_str ( )
244+ . expect ( "ClientAuthenticationMethod should serialize to a string" ) ;
245+
238246 formatdoc ! (
239247 "
240248 {{ 'name': 'keycloak',
@@ -248,6 +256,7 @@ fn append_oidc_config(
248256 }},
249257 'api_base_url': '{api_base_url}',
250258 'server_metadata_url': '{well_known_config_url}',
259+ 'token_endpoint_auth_method': '{client_auth_method}',
251260 }},
252261 }}" ,
253262 scopes = scopes. join( " " ) ,
@@ -460,6 +469,7 @@ mod tests {
460469 oidc: oidc:: v1alpha1:: ClientAuthenticationOptions {
461470 client_credentials_secret_ref: "test-client-secret1" . to_string( ) ,
462471 extra_scopes: vec![ "roles" . to_string( ) ] ,
472+ client_authentication_method: Default :: default ( ) ,
463473 product_specific_fields: ( ) ,
464474 } ,
465475 } ,
@@ -468,6 +478,7 @@ mod tests {
468478 oidc: oidc:: v1alpha1:: ClientAuthenticationOptions {
469479 client_credentials_secret_ref: "test-client-secret2" . to_string( ) ,
470480 extra_scopes: vec![ ] ,
481+ client_authentication_method: Default :: default ( ) ,
471482 product_specific_fields: ( ) ,
472483 } ,
473484 } ,
@@ -509,6 +520,7 @@ mod tests {
509520 }},
510521 'api_base_url': 'https://my.keycloak1.server:12345/realms/sdp/protocol/',
511522 'server_metadata_url': 'https://my.keycloak1.server:12345/realms/sdp/.well-known/openid-configuration',
523+ 'token_endpoint_auth_method': 'client_secret_basic',
512524 }},
513525 }},
514526 {{ 'name': 'keycloak',
@@ -522,6 +534,7 @@ mod tests {
522534 }},
523535 'api_base_url': 'http://my.keycloak2.server/protocol/',
524536 'server_metadata_url': 'http://my.keycloak2.server/.well-known/openid-configuration',
537+ 'token_endpoint_auth_method': 'client_secret_basic',
525538 }},
526539 }}
527540 ]
0 commit comments