@@ -76,9 +76,8 @@ impl RegistryConfigExtended {
7676/// Get the list of credential providers for a registry source.
7777fn credential_provider ( config : & Config , sid : & SourceId ) -> CargoResult < Vec < Vec < String > > > {
7878 let cfg = registry_credential_config_raw ( config, sid) ?;
79- let allow_cred_proc = config. cli_unstable ( ) . credential_process ;
8079 let default_providers = || {
81- if allow_cred_proc {
80+ if config . cli_unstable ( ) . asymmetric_token {
8281 // Enable the PASETO provider
8382 vec ! [
8483 vec![ "cargo:token" . to_string( ) ] ,
@@ -90,7 +89,7 @@ fn credential_provider(config: &Config, sid: &SourceId) -> CargoResult<Vec<Vec<S
9089 } ;
9190 let global_providers = config
9291 . get :: < Option < Vec < Value < String > > > > ( "registry.global-credential-providers" ) ?
93- . filter ( |p| !p. is_empty ( ) && allow_cred_proc )
92+ . filter ( |p| !p. is_empty ( ) && config . cli_unstable ( ) . credential_process )
9493 . map ( |p| {
9594 p. iter ( )
9695 . rev ( )
@@ -108,7 +107,7 @@ fn credential_provider(config: &Config, sid: &SourceId) -> CargoResult<Vec<Vec<S
108107 token,
109108 secret_key,
110109 ..
111- } ) if allow_cred_proc => {
110+ } ) if config . cli_unstable ( ) . credential_process => {
112111 if let Some ( token) = token {
113112 config. shell ( ) . warn ( format ! (
114113 "{sid} has a token configured in {} that will be ignored \
@@ -131,7 +130,7 @@ fn credential_provider(config: &Config, sid: &SourceId) -> CargoResult<Vec<Vec<S
131130 token : Some ( token) ,
132131 secret_key : Some ( secret_key) ,
133132 ..
134- } ) if allow_cred_proc => {
133+ } ) if config . cli_unstable ( ) . asymmetric_token => {
135134 let token_pos = global_providers
136135 . iter ( )
137136 . position ( |p| p. first ( ) . map ( String :: as_str) == Some ( "cargo:token" ) ) ;
@@ -182,7 +181,7 @@ fn credential_provider(config: &Config, sid: &SourceId) -> CargoResult<Vec<Vec<S
182181 Some ( RegistryConfig {
183182 secret_key : Some ( token) ,
184183 ..
185- } ) if allow_cred_proc => {
184+ } ) if config . cli_unstable ( ) . asymmetric_token => {
186185 if !global_providers
187186 . iter ( )
188187 . any ( |p| p. first ( ) . map ( String :: as_str) == Some ( "cargo:paseto" ) )
@@ -454,7 +453,10 @@ fn credential_action(
454453 tracing:: debug!( "attempting credential provider: {args:?}" ) ;
455454 let provider: Box < dyn Credential > = match process {
456455 "cargo:token" => Box :: new ( TokenCredential :: new ( config) ) ,
457- "cargo:paseto" => Box :: new ( PasetoCredential :: new ( config) ) ,
456+ "cargo:paseto" if config. cli_unstable ( ) . asymmetric_token => {
457+ Box :: new ( PasetoCredential :: new ( config) )
458+ }
459+ "cargo:paseto" => bail ! ( "cargo:paseto requires -Zasymmetric-token" ) ,
458460 "cargo:token-from-stdout" => Box :: new ( BasicProcessCredential { } ) ,
459461 "cargo:wincred" => Box :: new ( cargo_credential_wincred:: WindowsCredential { } ) ,
460462 "cargo:macos-keychain" => Box :: new ( cargo_credential_macos_keychain:: MacKeychain { } ) ,
0 commit comments