Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/oidc-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class OidcUtils {
core.exportVariable('JFROG_CLI_USAGE_OIDC_USED', 'TRUE');
}
static buildOidcTokenExchangePayload(jwt, providerName, applicationKey) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
return {
grant_type: 'urn:ietf:params:oauth:grant-type:token-exchange',
subject_token_type: 'urn:ietf:params:oauth:token-type:id_token',
Expand All @@ -233,6 +233,8 @@ class OidcUtils {
gh_job_id: (_b = process.env.GITHUB_JOB) !== null && _b !== void 0 ? _b : '',
gh_run_id: (_c = process.env.GITHUB_RUN_ID) !== null && _c !== void 0 ? _c : '',
gh_repo: (_d = process.env.GITHUB_REPOSITORY) !== null && _d !== void 0 ? _d : '',
gh_revision: (_e = process.env.GITHUB_SHA) !== null && _e !== void 0 ? _e : '',
gh_branch: (_f = process.env.GITHUB_REF_NAME) !== null && _f !== void 0 ? _f : '',
application_key: applicationKey,
};
}
Expand Down
4 changes: 3 additions & 1 deletion src/oidc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class OidcUtils {
}

const args = ['eot', creds.oidcProviderName, creds.oidcTokenId, '--url', creds.jfrogUrl];
if (creds.oidcAudience !== "") {
if (creds.oidcAudience !== '') {
args.push('--oidc-audience', creds.oidcAudience);
}
core.debug('Running CLI command: ' + args.join(' '));
Expand Down Expand Up @@ -221,6 +221,8 @@ export class OidcUtils {
gh_job_id: process.env.GITHUB_JOB ?? '',
gh_run_id: process.env.GITHUB_RUN_ID ?? '',
gh_repo: process.env.GITHUB_REPOSITORY ?? '',
gh_revision: process.env.GITHUB_SHA ?? '',
gh_branch: process.env.GITHUB_REF_NAME ?? '',
application_key: applicationKey,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface JfrogCredentials {
accessToken?: string;
oidcProviderName?: string;
oidcTokenId?: string;
oidcAudience : string;
oidcAudience: string;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('Collect JFrog Credentials from env vars exceptions', () => {
expect(jfrogCredentials.accessToken).toBeUndefined();
expect(jfrogCredentials.username).toBeUndefined();
expect(jfrogCredentials.password).toBeUndefined();
expect(jfrogCredentials.oidcAudience).toEqual("")
expect(jfrogCredentials.oidcAudience).toEqual('');
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/oidc-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('OidcUtils', (): void => {
it('should throw if creds are missing required fields', async (): Promise<void> => {
const incompleteCreds: JfrogCredentials = {
jfrogUrl: 'https://example.jfrog.io',
oidcAudience: ''
oidcAudience: '',
// missing provider and token ID
};

Expand Down
Loading