/
var
/
www
/
qr4y.com
/
server
/
delivery
/
node_modules
/
google-auth-library
/
build
/
src
/
auth
/
/var/www/qr4y.com/server/delivery/node_modules/google-auth-library/build/src/auth
mkdir
upload
Name
Size
Mode
Actions
authclient.d.ts
4018
0644
edit
dl
rm
authclient.js
2144
0644
edit
dl
rm
awsclient.d.ts
4190
0644
edit
dl
rm
awsclient.js
10953
0644
edit
dl
rm
awsrequestsigner.d.ts
1630
0644
edit
dl
rm
awsrequestsigner.js
9296
0644
edit
dl
rm
baseexternalclient.d.ts
9385
0644
edit
dl
rm
baseexternalclient.js
19839
0644
edit
dl
rm
computeclient.d.ts
1345
0644
edit
dl
rm
computeclient.js
4442
0644
edit
dl
rm
credentials.d.ts
2276
0644
edit
dl
rm
credentials.js
704
0644
edit
dl
rm
downscopedclient.d.ts
6540
0644
edit
dl
rm
downscopedclient.js
13166
0644
edit
dl
rm
envDetect.d.ts
324
0644
edit
dl
rm
envDetect.js
2667
0644
edit
dl
rm
externalclient.d.ts
1265
0644
edit
dl
rm
externalclient.js
2636
0644
edit
dl
rm
googleauth.d.ts
11057
0644
edit
dl
rm
googleauth.js
28640
0644
edit
dl
rm
iam.d.ts
623
0644
edit
dl
rm
iam.js
1348
0644
edit
dl
rm
identitypoolclient.d.ts
3700
0644
edit
dl
rm
identitypoolclient.js
7567
0644
edit
dl
rm
idtokenclient.d.ts
896
0644
edit
dl
rm
idtokenclient.js
2088
0644
edit
dl
rm
impersonated.d.ts
3883
0644
edit
dl
rm
impersonated.js
5797
0644
edit
dl
rm
jwtaccess.d.ts
2409
0644
edit
dl
rm
jwtaccess.js
6987
0644
edit
dl
rm
jwtclient.d.ts
3833
0644
edit
dl
rm
jwtclient.js
9960
0644
edit
dl
rm
loginticket.d.ts
5367
0644
edit
dl
rm
loginticket.js
1768
0644
edit
dl
rm
oauth2client.d.ts
22189
0644
edit
dl
rm
oauth2client.js
30818
0644
edit
dl
rm
oauth2common.d.ts
3393
0644
edit
dl
rm
oauth2common.js
7734
0644
edit
dl
rm
refreshclient.d.ts
1675
0644
edit
dl
rm
refreshclient.js
4140
0644
edit
dl
rm
stscredentials.d.ts
4636
0644
edit
dl
rm
stscredentials.js
4886
0644
edit
dl
rm
Edit:
/var/www/qr4y.com/server/delivery/node_modules/google-auth-library/build/src/auth/jwtaccess.js
(6987B)
"use strict"; // Copyright 2015 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.JWTAccess = void 0; const jws = require("jws"); const LRU = require("lru-cache"); const DEFAULT_HEADER = { alg: 'RS256', typ: 'JWT', }; class JWTAccess { /** * JWTAccess service account credentials. * * Create a new access token by using the credential to create a new JWT token * that's recognized as the access token. * * @param email the service account email address. * @param key the private key that will be used to sign the token. * @param keyId the ID of the private key used to sign the token. */ constructor(email, key, keyId, eagerRefreshThresholdMillis) { this.cache = new LRU({ max: 500, maxAge: 60 * 60 * 1000, }); this.email = email; this.key = key; this.keyId = keyId; this.eagerRefreshThresholdMillis = eagerRefreshThresholdMillis !== null && eagerRefreshThresholdMillis !== void 0 ? eagerRefreshThresholdMillis : 5 * 60 * 1000; } /** * Ensures that we're caching a key appropriately, giving precedence to scopes vs. url * * @param url The URI being authorized. * @param scopes The scope or scopes being authorized * @returns A string that returns the cached key. */ getCachedKey(url, scopes) { let cacheKey = url; if (scopes && Array.isArray(scopes) && scopes.length) { cacheKey = url ? `${url}_${scopes.join('_')}` : `${scopes.join('_')}`; } else if (typeof scopes === 'string') { cacheKey = url ? `${url}_${scopes}` : scopes; } if (!cacheKey) { throw Error('Scopes or url must be provided'); } return cacheKey; } /** * Get a non-expired access token, after refreshing if necessary. * * @param url The URI being authorized. * @param additionalClaims An object with a set of additional claims to * include in the payload. * @returns An object that includes the authorization header. */ getRequestHeaders(url, additionalClaims, scopes) { // Return cached authorization headers, unless we are within // eagerRefreshThresholdMillis ms of them expiring: const key = this.getCachedKey(url, scopes); const cachedToken = this.cache.get(key); const now = Date.now(); if (cachedToken && cachedToken.expiration - now > this.eagerRefreshThresholdMillis) { return cachedToken.headers; } const iat = Math.floor(Date.now() / 1000); const exp = JWTAccess.getExpirationTime(iat); let defaultClaims; // Turn scopes into space-separated string if (Array.isArray(scopes)) { scopes = scopes.join(' '); } // If scopes are specified, sign with scopes if (scopes) { defaultClaims = { iss: this.email, sub: this.email, scope: scopes, exp, iat, }; } else { defaultClaims = { iss: this.email, sub: this.email, aud: url, exp, iat, }; } // if additionalClaims are provided, ensure they do not collide with // other required claims. if (additionalClaims) { for (const claim in defaultClaims) { if (additionalClaims[claim]) { throw new Error(`The '${claim}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`); } } } const header = this.keyId ? { ...DEFAULT_HEADER, kid: this.keyId } : DEFAULT_HEADER; const payload = Object.assign(defaultClaims, additionalClaims); // Sign the jwt and add it to the cache const signedJWT = jws.sign({ header, payload, secret: this.key }); const headers = { Authorization: `Bearer ${signedJWT}` }; this.cache.set(key, { expiration: exp * 1000, headers, }); return headers; } /** * Returns an expiration time for the JWT token. * * @param iat The issued at time for the JWT. * @returns An expiration time for the JWT. */ static getExpirationTime(iat) { const exp = iat + 3600; // 3600 seconds = 1 hour return exp; } /** * Create a JWTAccess credentials instance using the given input options. * @param json The input object. */ fromJSON(json) { if (!json) { throw new Error('Must pass in a JSON object containing the service account auth settings.'); } if (!json.client_email) { throw new Error('The incoming JSON object does not contain a client_email field'); } if (!json.private_key) { throw new Error('The incoming JSON object does not contain a private_key field'); } // Extract the relevant information from the json key file. this.email = json.client_email; this.key = json.private_key; this.keyId = json.private_key_id; this.projectId = json.project_id; } fromStream(inputStream, callback) { if (callback) { this.fromStreamAsync(inputStream).then(() => callback(), callback); } else { return this.fromStreamAsync(inputStream); } } fromStreamAsync(inputStream) { return new Promise((resolve, reject) => { if (!inputStream) { reject(new Error('Must pass in a stream containing the service account auth settings.')); } let s = ''; inputStream .setEncoding('utf8') .on('data', chunk => (s += chunk)) .on('error', reject) .on('end', () => { try { const data = JSON.parse(s); this.fromJSON(data); resolve(); } catch (err) { reject(err); } }); }); } } exports.JWTAccess = JWTAccess; //# sourceMappingURL=jwtaccess.js.map
Save
cmd:
run