@@ -554,25 +554,34 @@ impl adbc_core::Database for Database {
554554 }
555555 AuthFlow :: ClientCredentials => {
556556 // Client credentials flow (M2M) - create ClientCredentialsProvider
557- let client_id = self . auth_client_id . as_ref ( )
557+ let client_id = self
558+ . auth_config
559+ . client_id
560+ . as_ref ( )
558561 . expect ( "client_id should be validated above" ) ;
559- let client_secret = self . auth_client_secret . as_ref ( )
562+ let client_secret = self
563+ . auth_config
564+ . client_secret
565+ . as_ref ( )
560566 . expect ( "client_secret should be validated above" ) ;
561567
562568 // Default scope for M2M is "all-apis" (no offline_access since M2M has no refresh token)
563- let scopes_str = self . auth_scopes . as_deref ( ) . unwrap_or ( "all-apis" ) ;
564- let scopes: Vec < String > = scopes_str. split_whitespace ( ) . map ( String :: from) . collect ( ) ;
569+ let scopes_str = self . auth_config . scopes . as_deref ( ) . unwrap_or ( "all-apis" ) ;
570+ let scopes: Vec < String > =
571+ scopes_str. split_whitespace ( ) . map ( String :: from) . collect ( ) ;
565572
566573 // Create the provider (async operation - needs runtime)
567574 let provider = runtime
568- . block_on ( crate :: auth:: ClientCredentialsProvider :: new_with_full_config (
569- host,
570- client_id,
571- client_secret,
572- http_client. clone ( ) ,
573- scopes,
574- self . auth_token_endpoint . clone ( ) ,
575- ) )
575+ . block_on (
576+ crate :: auth:: ClientCredentialsProvider :: new_with_full_config (
577+ host,
578+ client_id,
579+ client_secret,
580+ http_client. clone ( ) ,
581+ scopes,
582+ self . auth_config . token_endpoint . clone ( ) ,
583+ ) ,
584+ )
576585 . map_err ( |e| e. to_adbc ( ) ) ?;
577586
578587 Arc :: new ( provider)
@@ -1572,10 +1581,13 @@ mod tests {
15721581 . unwrap ( ) ;
15731582
15741583 // Verify config is stored correctly
1575- assert_eq ! ( db. auth_mechanism, Some ( AuthMechanism :: OAuth ) ) ;
1576- assert_eq ! ( db. auth_flow, Some ( AuthFlow :: ClientCredentials ) ) ;
1577- assert_eq ! ( db. auth_client_id, Some ( "test-client-id" . to_string( ) ) ) ;
1578- assert_eq ! ( db. auth_client_secret, Some ( "test-secret" . to_string( ) ) ) ;
1584+ assert_eq ! ( db. auth_config. mechanism, Some ( AuthMechanism :: OAuth ) ) ;
1585+ assert_eq ! ( db. auth_config. flow, Some ( AuthFlow :: ClientCredentials ) ) ;
1586+ assert_eq ! ( db. auth_config. client_id, Some ( "test-client-id" . to_string( ) ) ) ;
1587+ assert_eq ! (
1588+ db. auth_config. client_secret,
1589+ Some ( "test-secret" . to_string( ) )
1590+ ) ;
15791591 }
15801592
15811593 #[ test]
@@ -1620,7 +1632,7 @@ mod tests {
16201632
16211633 // Verify custom scopes are stored
16221634 assert_eq ! (
1623- db. auth_scopes ,
1635+ db. auth_config . scopes ,
16241636 Some ( "custom-scope-1 custom-scope-2" . to_string( ) )
16251637 ) ;
16261638 }
@@ -1667,7 +1679,7 @@ mod tests {
16671679
16681680 // Verify token_endpoint override is stored
16691681 assert_eq ! (
1670- db. auth_token_endpoint ,
1682+ db. auth_config . token_endpoint ,
16711683 Some ( "https://custom.endpoint/token" . to_string( ) )
16721684 ) ;
16731685 }
0 commit comments