/opt/canhelp/node_modules/google-auth-library/build/src/auth
NameSizeModeActions
authclient.d.ts107640644editdlrm
authclient.js112470644editdlrm
awsclient.d.ts53150644editdlrm
awsclient.js75560644editdlrm
awsrequestsigner.d.ts16260644editdlrm
awsrequestsigner.js94420644editdlrm
baseexternalclient.d.ts130200644editdlrm
baseexternalclient.js208570644editdlrm
certificatesubjecttokensupplier.d.ts22020644editdlrm
certificatesubjecttokensupplier.js106190644editdlrm
computeclient.d.ts13590644editdlrm
computeclient.js44970644editdlrm
credentials.d.ts23590644editdlrm
credentials.js7040644editdlrm
defaultawssecuritycredentialssupplier.d.ts37950644editdlrm
defaultawssecuritycredentialssupplier.js93300644editdlrm
downscopedclient.d.ts66930644editdlrm
downscopedclient.js123530644editdlrm
envDetect.d.ts3630644editdlrm
envDetect.js28310644editdlrm
executable-response.d.ts44890644editdlrm
executable-response.js75190644editdlrm
externalAccountAuthorizedUserClient.d.ts31730644editdlrm
externalAccountAuthorizedUserClient.js100050644editdlrm
externalclient.d.ts15280644editdlrm
externalclient.js30480644editdlrm
filesubjecttokensupplier.d.ts16080644editdlrm
filesubjecttokensupplier.js35150644editdlrm
googleauth.d.ts235740644editdlrm
googleauth.js363740644editdlrm
iam.d.ts6230644editdlrm
iam.js13730644editdlrm
identitypoolclient.d.ts56260644editdlrm
identitypoolclient.js67750644editdlrm
idtokenclient.d.ts9380644editdlrm
idtokenclient.js21060644editdlrm
impersonated.d.ts56870644editdlrm
impersonated.js86540644editdlrm
jwtaccess.d.ts23360644editdlrm
jwtaccess.js72130644editdlrm
jwtclient.d.ts51220644editdlrm
jwtclient.js112560644editdlrm
loginticket.d.ts53670644editdlrm
loginticket.js17950644editdlrm
oauth2client.d.ts253260644editdlrm
oauth2client.js336620644editdlrm
oauth2common.d.ts40940644editdlrm
oauth2common.js80800644editdlrm
passthrough.d.ts10970644editdlrm
passthrough.js18420644editdlrm
pluggable-auth-client.d.ts54850644editdlrm
pluggable-auth-client.js100020644editdlrm
pluggable-auth-handler.d.ts21090644editdlrm
pluggable-auth-handler.js72600644editdlrm
refreshclient.d.ts34360644editdlrm
refreshclient.js66500644editdlrm
stscredentials.d.ts52610644editdlrm
stscredentials.js47380644editdlrm
urlsubjecttokensupplier.d.ts21860644editdlrm
urlsubjecttokensupplier.js28590644editdlrm
Edit: /opt/canhelp/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js (3515B)
"use strict"; // Copyright 2024 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.FileSubjectTokenSupplier = void 0; const util_1 = require("util"); const fs = require("fs"); // fs.readfile is undefined in browser karma tests causing // `npm run browser-test` to fail as test.oauth2.ts imports this file via // src/index.ts. // Fallback to void function to avoid promisify throwing a TypeError. const readFile = (0, util_1.promisify)(fs.readFile ?? (() => { })); const realpath = (0, util_1.promisify)(fs.realpath ?? (() => { })); const lstat = (0, util_1.promisify)(fs.lstat ?? (() => { })); /** * Internal subject token supplier implementation used when a file location * is configured in the credential configuration used to build an {@link IdentityPoolClient} */ class FileSubjectTokenSupplier { filePath; formatType; subjectTokenFieldName; /** * Instantiates a new file based subject token supplier. * @param opts The file subject token supplier options to build the supplier * with. */ constructor(opts) { this.filePath = opts.filePath; this.formatType = opts.formatType; this.subjectTokenFieldName = opts.subjectTokenFieldName; } /** * Returns the subject token stored at the file specified in the constructor. * @param context {@link ExternalAccountSupplierContext} from the calling * {@link IdentityPoolClient}, contains the requested audience and subject * token type for the external account identity. Not used. */ async getSubjectToken() { // Make sure there is a file at the path. lstatSync will throw if there is // nothing there. let parsedFilePath = this.filePath; try { // Resolve path to actual file in case of symlink. Expect a thrown error // if not resolvable. parsedFilePath = await realpath(parsedFilePath); if (!(await lstat(parsedFilePath)).isFile()) { throw new Error(); } } catch (err) { if (err instanceof Error) { err.message = `The file at ${parsedFilePath} does not exist, or it is not a file. ${err.message}`; } throw err; } let subjectToken; const rawText = await readFile(parsedFilePath, { encoding: 'utf8' }); if (this.formatType === 'text') { subjectToken = rawText; } else if (this.formatType === 'json' && this.subjectTokenFieldName) { const json = JSON.parse(rawText); subjectToken = json[this.subjectTokenFieldName]; } if (!subjectToken) { throw new Error('Unable to parse the subject_token from the credential_source file'); } return subjectToken; } } exports.FileSubjectTokenSupplier = FileSubjectTokenSupplier; //# sourceMappingURL=filesubjecttokensupplier.js.map