From 7f5ab1e2a1764c5289c739e4a3f435126b9beeb0 Mon Sep 17 00:00:00 2001 From: yahavi Date: Sun, 21 Jan 2024 16:13:24 +0200 Subject: [PATCH] Rephrase --- lib/utils.js | 8 ++++---- src/utils.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 916ff45ef..d0543502f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -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}`); @@ -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", diff --git a/src/utils.ts b/src/utils.ts index c488cd268..0100772a3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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}`); } @@ -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 { // 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 = `{