@@ -36,7 +36,7 @@ export class OidcUtils {
3636 for further use by the users, this cannot be done in secure way using jf config add command.
3737
3838 */
39- public static async exchangeOidcToken ( jfrogCredentials : JfrogCredentials ) : Promise < string | undefined > {
39+ public static async exchangeOidcToken ( jfrogCredentials : JfrogCredentials , forceManual : boolean = false ) : Promise < string | undefined > {
4040 if ( ! jfrogCredentials . jfrogUrl ) {
4141 throw new Error ( `JF_URL must be provided when oidc-provider-name is specified` ) ;
4242 }
@@ -49,13 +49,14 @@ export class OidcUtils {
4949 }
5050
5151 // Version should be more than min version
52- // If CLI_REMOTE_ARG specified, we have to fetch token before we can download the CLI.
53- if ( this . isCLIVersionOidcSupported ( ) && ! core . getInput ( Utils . CLI_REMOTE_ARG ) ) {
52+ // If forceManual is true (e.g., for CLI download from remote repo), use manual flow.
53+ // Otherwise, prefer native CLI flow if version is supported.
54+ if ( this . isCLIVersionOidcSupported ( ) && ! forceManual ) {
5455 core . debug ( 'Using CLI exchange-oidc-token..' ) ;
5556 return await this . exchangeOIDCTokenAndExportStepOutputs ( jfrogCredentials ) ;
5657 }
5758
58- // Fallback to manual OIDC exchange for backward compatibility
59+ // Fallback to manual OIDC exchange for backward compatibility or when forced
5960 core . debug ( 'Using Manual OIDC Auth Method..' ) ;
6061 // Exchanges the token and set as access token in the credential's object
6162 let token : string | undefined = await this . manualExchangeOidc ( jfrogCredentials ) ;
@@ -304,6 +305,7 @@ export class OidcUtils {
304305
305306 public static isCLIVersionOidcSupported ( ) : boolean {
306307 const version : string = core . getInput ( Utils . CLI_VERSION_ARG ) || '' ;
308+ core . info ( "SHAYS Checking if CLI version supports OIDC token exchange. Provided version: '" + version + "'" ) ;
307309 if ( version === '' ) {
308310 // No input meaning default version which is supported
309311 return true ;
0 commit comments