Skip to content

Commit

Permalink
Rephrase
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Jan 21, 2024
1 parent 60e4358 commit 7f5ab1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Utils {
throw new Error(`Getting openID Connect JSON web token failed: ${error.message}`);
}
try {
return yield this.getAccessTokenFromJWT(jfrogCredentials, jsonWebToken, oidcProviderName);
return yield this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
}
catch (error) {
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);
Expand Down Expand Up @@ -98,17 +98,17 @@ class Utils {
return jfrogCredentials;
}
/**
* Exchanges JWT with a valid access token
* Exchanges GitHub JWT with a valid JFrog access token
* @param jfrogCredentials existing JFrog credentials - url, access token, username + password
* @param jsonWebToken JWT achieved from GitHub JWT provider
* @param oidcProviderName OIDC provider name
* @returns an access token for the requested Artifactory server
*/
static getAccessTokenFromJWT(jfrogCredentials, jsonWebToken, oidcProviderName) {
static getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName) {
return __awaiter(this, void 0, void 0, function* () {
// If we've reached this stage, the jfrogCredentials.jfrogUrl field should hold a non-empty value obtained from process.env.JF_URL
const exchangeUrl = jfrogCredentials.jfrogUrl.replace(/\/$/, '') + '/access/api/v1/oidc/token';
core.debug('Exchanging JSON web token with an access token');
core.debug('Exchanging GitHub JSON web token with a JFrog access token...');
const httpClient = new http_client_1.HttpClient();
const data = `{
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class Utils {
}

try {
return await this.getAccessTokenFromJWT(jfrogCredentials, jsonWebToken, oidcProviderName);
return await this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
} catch (error: any) {
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);
}
Expand Down Expand Up @@ -99,20 +99,20 @@ export class Utils {
}

/**
* Exchanges JWT with a valid access token
* Exchanges GitHub JWT with a valid JFrog access token
* @param jfrogCredentials existing JFrog credentials - url, access token, username + password
* @param jsonWebToken JWT achieved from GitHub JWT provider
* @param oidcProviderName OIDC provider name
* @returns an access token for the requested Artifactory server
*/
private static async getAccessTokenFromJWT(
private static async getJfrogAccessTokenThroughOidcProtocol(
jfrogCredentials: JfrogCredentials,
jsonWebToken: string,
oidcProviderName: string,
): Promise<JfrogCredentials> {
// If we've reached this stage, the jfrogCredentials.jfrogUrl field should hold a non-empty value obtained from process.env.JF_URL
const exchangeUrl: string = jfrogCredentials.jfrogUrl!.replace(/\/$/, '') + '/access/api/v1/oidc/token';
core.debug('Exchanging JSON web token with an access token');
core.debug('Exchanging GitHub JSON web token with a JFrog access token...');

const httpClient: HttpClient = new HttpClient();
const data: string = `{
Expand Down

0 comments on commit 7f5ab1e

Please sign in to comment.