/var/www/qr4y.gr/server/delivery/node_modules/google-auth-library/build/src/auth
NameSizeModeActions
authclient.d.ts40180644editdlrm
authclient.js21440644editdlrm
awsclient.d.ts41900644editdlrm
awsclient.js109530644editdlrm
awsrequestsigner.d.ts16300644editdlrm
awsrequestsigner.js92960644editdlrm
baseexternalclient.d.ts93850644editdlrm
baseexternalclient.js198390644editdlrm
computeclient.d.ts13450644editdlrm
computeclient.js44420644editdlrm
credentials.d.ts22760644editdlrm
credentials.js7040644editdlrm
downscopedclient.d.ts65400644editdlrm
downscopedclient.js131660644editdlrm
envDetect.d.ts3240644editdlrm
envDetect.js26670644editdlrm
externalclient.d.ts12650644editdlrm
externalclient.js26360644editdlrm
googleauth.d.ts110570644editdlrm
googleauth.js286400644editdlrm
iam.d.ts6230644editdlrm
iam.js13480644editdlrm
identitypoolclient.d.ts37000644editdlrm
identitypoolclient.js75670644editdlrm
idtokenclient.d.ts8960644editdlrm
idtokenclient.js20880644editdlrm
impersonated.d.ts38830644editdlrm
impersonated.js57970644editdlrm
jwtaccess.d.ts24090644editdlrm
jwtaccess.js69870644editdlrm
jwtclient.d.ts38330644editdlrm
jwtclient.js99600644editdlrm
loginticket.d.ts53670644editdlrm
loginticket.js17680644editdlrm
oauth2client.d.ts221890644editdlrm
oauth2client.js308180644editdlrm
oauth2common.d.ts33930644editdlrm
oauth2common.js77340644editdlrm
refreshclient.d.ts16750644editdlrm
refreshclient.js41400644editdlrm
stscredentials.d.ts46360644editdlrm
stscredentials.js48860644editdlrm
Edit: /var/www/qr4y.gr/server/delivery/node_modules/google-auth-library/build/src/auth/impersonated.js (5797B)
"use strict"; /** * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Impersonated = exports.IMPERSONATED_ACCOUNT_TYPE = void 0; const oauth2client_1 = require("./oauth2client"); const gaxios_1 = require("gaxios"); exports.IMPERSONATED_ACCOUNT_TYPE = 'impersonated_service_account'; class Impersonated extends oauth2client_1.OAuth2Client { /** * Impersonated service account credentials. * * Create a new access token by impersonating another service account. * * Impersonated Credentials allowing credentials issued to a user or * service account to impersonate another. The source project using * Impersonated Credentials must enable the "IAMCredentials" API. * Also, the target service account must grant the orginating principal * the "Service Account Token Creator" IAM role. * * @param {object} options - The configuration object. * @param {object} [options.sourceClient] the source credential used as to * acquire the impersonated credentials. * @param {string} [options.targetPrincipal] the service account to * impersonate. * @param {string[]} [options.delegates] the chained list of delegates * required to grant the final access_token. If set, the sequence of * identities must have "Service Account Token Creator" capability granted to * the preceding identity. For example, if set to [serviceAccountB, * serviceAccountC], the sourceCredential must have the Token Creator role on * serviceAccountB. serviceAccountB must have the Token Creator on * serviceAccountC. Finally, C must have Token Creator on target_principal. * If left unset, sourceCredential must have that role on targetPrincipal. * @param {string[]} [options.targetScopes] scopes to request during the * authorization grant. * @param {number} [options.lifetime] number of seconds the delegated * credential should be valid for up to 3600 seconds by default, or 43,200 * seconds by extending the token's lifetime, see: * https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials#sa-credentials-oauth * @param {string} [options.endpoint] api endpoint override. */ constructor(options = {}) { var _a, _b, _c, _d, _e, _f; super(options); this.credentials = { expiry_date: 1, refresh_token: 'impersonated-placeholder', }; this.sourceClient = (_a = options.sourceClient) !== null && _a !== void 0 ? _a : new oauth2client_1.OAuth2Client(); this.targetPrincipal = (_b = options.targetPrincipal) !== null && _b !== void 0 ? _b : ''; this.delegates = (_c = options.delegates) !== null && _c !== void 0 ? _c : []; this.targetScopes = (_d = options.targetScopes) !== null && _d !== void 0 ? _d : []; this.lifetime = (_e = options.lifetime) !== null && _e !== void 0 ? _e : 3600; this.endpoint = (_f = options.endpoint) !== null && _f !== void 0 ? _f : 'https://iamcredentials.googleapis.com'; } /** * Refreshes the access token. * @param refreshToken Unused parameter */ async refreshToken(refreshToken) { var _a, _b, _c, _d, _e, _f; try { await this.sourceClient.getAccessToken(); const name = 'projects/-/serviceAccounts/' + this.targetPrincipal; const u = `${this.endpoint}/v1/${name}:generateAccessToken`; const body = { delegates: this.delegates, scope: this.targetScopes, lifetime: this.lifetime + 's', }; const res = await this.sourceClient.request({ url: u, data: body, method: 'POST', }); const tokenResponse = res.data; this.credentials.access_token = tokenResponse.accessToken; this.credentials.expiry_date = Date.parse(tokenResponse.expireTime); return { tokens: this.credentials, res, }; } catch (error) { if (!(error instanceof Error)) throw error; let status = 0; let message = ''; if (error instanceof gaxios_1.GaxiosError) { status = (_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.status; message = (_f = (_e = (_d = error === null || error === void 0 ? void 0 : error.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.message; } if (status && message) { error.message = `${status}: unable to impersonate: ${message}`; throw error; } else { error.message = `unable to impersonate: ${error}`; throw error; } } } } exports.Impersonated = Impersonated; //# sourceMappingURL=impersonated.js.map