@@ -429,6 +429,7 @@ fn credential_action(
429
429
sid : & SourceId ,
430
430
action : Action < ' _ > ,
431
431
headers : Vec < String > ,
432
+ args : & [ & str ] ,
432
433
) -> CargoResult < CredentialResponse > {
433
434
let name = if sid. is_crates_io ( ) {
434
435
Some ( CRATES_IO_REGISTRY )
@@ -442,7 +443,11 @@ fn credential_action(
442
443
} ;
443
444
let providers = credential_provider ( config, sid) ?;
444
445
for provider in providers {
445
- let args: Vec < & str > = provider. iter ( ) . map ( String :: as_str) . collect ( ) ;
446
+ let args: Vec < & str > = provider
447
+ . iter ( )
448
+ . map ( String :: as_str)
449
+ . chain ( args. iter ( ) . map ( |s| * s) )
450
+ . collect ( ) ;
446
451
let process = args[ 0 ] ;
447
452
tracing:: debug!( "attempting credential provider: {args:?}" ) ;
448
453
let provider: Box < dyn Credential > = match process {
@@ -529,7 +534,7 @@ fn auth_token_optional(
529
534
}
530
535
}
531
536
532
- let credential_response = credential_action ( config, sid, Action :: Get ( operation) , headers) ;
537
+ let credential_response = credential_action ( config, sid, Action :: Get ( operation) , headers, & [ ] ) ;
533
538
if let Some ( e) = credential_response. as_ref ( ) . err ( ) {
534
539
if let Some ( e) = e. downcast_ref :: < cargo_credential:: Error > ( ) {
535
540
if matches ! ( e, cargo_credential:: Error :: NotFound ) {
@@ -568,7 +573,7 @@ fn auth_token_optional(
568
573
569
574
/// Log out from the given registry.
570
575
pub fn logout ( config : & Config , sid : & SourceId ) -> CargoResult < ( ) > {
571
- let credential_response = credential_action ( config, sid, Action :: Logout , vec ! [ ] ) ;
576
+ let credential_response = credential_action ( config, sid, Action :: Logout , vec ! [ ] , & [ ] ) ;
572
577
if let Some ( e) = credential_response. as_ref ( ) . err ( ) {
573
578
if let Some ( e) = e. downcast_ref :: < cargo_credential:: Error > ( ) {
574
579
if matches ! ( e, cargo_credential:: Error :: NotFound ) {
@@ -591,8 +596,13 @@ pub fn logout(config: &Config, sid: &SourceId) -> CargoResult<()> {
591
596
}
592
597
593
598
/// Log in to the given registry.
594
- pub fn login ( config : & Config , sid : & SourceId , options : LoginOptions < ' _ > ) -> CargoResult < ( ) > {
595
- let credential_response = credential_action ( config, sid, Action :: Login ( options) , vec ! [ ] ) ?;
599
+ pub fn login (
600
+ config : & Config ,
601
+ sid : & SourceId ,
602
+ options : LoginOptions < ' _ > ,
603
+ args : & [ & str ] ,
604
+ ) -> CargoResult < ( ) > {
605
+ let credential_response = credential_action ( config, sid, Action :: Login ( options) , vec ! [ ] , args) ?;
596
606
let CredentialResponse :: Login = credential_response else {
597
607
bail ! ( "credential provider produced unexpected response for `login` request: {credential_response:?}" )
598
608
} ;
0 commit comments