GoogleOauth2.0 First implementation
First try for GoogleOauth2.0
This commit is contained in:
35
express-server/node_modules/google-auth-library/build/src/auth/authclient.d.ts
generated
vendored
Normal file
35
express-server/node_modules/google-auth-library/build/src/auth/authclient.d.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { AxiosPromise, AxiosRequestConfig } from 'axios';
|
||||
import { EventEmitter } from 'events';
|
||||
import { DefaultTransporter } from '../transporters';
|
||||
import { Credentials } from './credentials';
|
||||
export declare interface AuthClient {
|
||||
on(event: 'tokens', listener: (tokens: Credentials) => void): this;
|
||||
}
|
||||
export declare abstract class AuthClient extends EventEmitter {
|
||||
transporter: DefaultTransporter;
|
||||
credentials: Credentials;
|
||||
/**
|
||||
* Provides an alternative Axios request implementation with auth credentials
|
||||
*/
|
||||
abstract request<T>(opts: AxiosRequestConfig): AxiosPromise<T>;
|
||||
/**
|
||||
* Sets the auth credentials.
|
||||
*/
|
||||
setCredentials(credentials: Credentials): void;
|
||||
}
|
34
express-server/node_modules/google-auth-library/build/src/auth/authclient.js
generated
vendored
Normal file
34
express-server/node_modules/google-auth-library/build/src/auth/authclient.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const events_1 = require("events");
|
||||
const transporters_1 = require("../transporters");
|
||||
class AuthClient extends events_1.EventEmitter {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.transporter = new transporters_1.DefaultTransporter();
|
||||
this.credentials = {};
|
||||
}
|
||||
/**
|
||||
* Sets the auth credentials.
|
||||
*/
|
||||
setCredentials(credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
}
|
||||
exports.AuthClient = AuthClient;
|
||||
//# sourceMappingURL=authclient.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/authclient.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/authclient.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"authclient.js","sourceRoot":"","sources":["../../../src/auth/authclient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAGH,mCAAoC;AAEpC,kDAAmD;AAQnD,MAAsB,UAAW,SAAQ,qBAAY;IAArD;;QACE,gBAAW,GAAG,IAAI,iCAAkB,EAAE,CAAC;QACvC,gBAAW,GAAgB,EAAE,CAAC;IAahC,CAAC;IANC;;OAEG;IACH,cAAc,CAAC,WAAwB;QACrC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAfD,gCAeC"}
|
47
express-server/node_modules/google-auth-library/build/src/auth/computeclient.d.ts
generated
vendored
Normal file
47
express-server/node_modules/google-auth-library/build/src/auth/computeclient.d.ts
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright 2013 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import { AxiosPromise, AxiosRequestConfig } from 'axios';
|
||||
import { GetTokenResponse, OAuth2Client, RefreshOptions } from './oauth2client';
|
||||
export interface ComputeOptions extends RefreshOptions {
|
||||
/**
|
||||
* The service account email to use, or 'default'. A Compute Engine instance
|
||||
* may have multiple service accounts.
|
||||
*/
|
||||
serviceAccountEmail?: string;
|
||||
}
|
||||
export declare class Compute extends OAuth2Client {
|
||||
private serviceAccountEmail;
|
||||
/**
|
||||
* Google Compute Engine service account credentials.
|
||||
*
|
||||
* Retrieve access token from the metadata server.
|
||||
* See: https://developers.google.com/compute/docs/authentication
|
||||
*/
|
||||
constructor(options?: ComputeOptions);
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return Boolean indicating if scope is required.
|
||||
*/
|
||||
createScopedRequired(): boolean;
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken Unused parameter
|
||||
*/
|
||||
protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
|
||||
protected requestAsync<T>(opts: AxiosRequestConfig, retry?: boolean): AxiosPromise<T>;
|
||||
}
|
116
express-server/node_modules/google-auth-library/build/src/auth/computeclient.js
generated
vendored
Normal file
116
express-server/node_modules/google-auth-library/build/src/auth/computeclient.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2013 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const gcpMetadata = require("gcp-metadata");
|
||||
const messages = require("../messages");
|
||||
const oauth2client_1 = require("./oauth2client");
|
||||
class Compute extends oauth2client_1.OAuth2Client {
|
||||
/**
|
||||
* Google Compute Engine service account credentials.
|
||||
*
|
||||
* Retrieve access token from the metadata server.
|
||||
* See: https://developers.google.com/compute/docs/authentication
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
// Start with an expired refresh token, which will automatically be
|
||||
// refreshed before the first API call is made.
|
||||
this.credentials = { expiry_date: 1, refresh_token: 'compute-placeholder' };
|
||||
this.serviceAccountEmail = options.serviceAccountEmail || 'default';
|
||||
}
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return Boolean indicating if scope is required.
|
||||
*/
|
||||
createScopedRequired() {
|
||||
// On compute engine, scopes are specified at the compute instance's
|
||||
// creation time, and cannot be changed. For this reason, always return
|
||||
// false.
|
||||
messages.warn(messages.COMPUTE_CREATE_SCOPED_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken Unused parameter
|
||||
*/
|
||||
refreshTokenNoCache(refreshToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const tokenPath = `service-accounts/${this.serviceAccountEmail}/token`;
|
||||
let res;
|
||||
try {
|
||||
res = yield gcpMetadata.instance(tokenPath);
|
||||
}
|
||||
catch (e) {
|
||||
e.message = 'Could not refresh access token.';
|
||||
throw e;
|
||||
}
|
||||
const tokens = res.data;
|
||||
if (res.data && res.data.expires_in) {
|
||||
tokens.expiry_date =
|
||||
((new Date()).getTime() + (res.data.expires_in * 1000));
|
||||
delete tokens.expires_in;
|
||||
}
|
||||
this.emit('tokens', tokens);
|
||||
return { tokens, res };
|
||||
});
|
||||
}
|
||||
requestAsync(opts, retry = false) {
|
||||
return super.requestAsync(opts, retry).catch(e => {
|
||||
const res = e.response;
|
||||
if (res && res.status) {
|
||||
let helpfulMessage = null;
|
||||
if (res.status === 403) {
|
||||
helpfulMessage =
|
||||
'A Forbidden error was returned while attempting to retrieve an access ' +
|
||||
'token for the Compute Engine built-in service account. This may be because the Compute ' +
|
||||
'Engine instance does not have the correct permission scopes specified.';
|
||||
}
|
||||
else if (res.status === 404) {
|
||||
helpfulMessage =
|
||||
'A Not Found error was returned while attempting to retrieve an access' +
|
||||
'token for the Compute Engine built-in service account. This may be because the Compute ' +
|
||||
'Engine instance does not have any permission scopes specified.';
|
||||
}
|
||||
if (helpfulMessage) {
|
||||
if (e && e.message && !retry) {
|
||||
helpfulMessage += ' ' + e.message;
|
||||
}
|
||||
if (e) {
|
||||
e.message = helpfulMessage;
|
||||
}
|
||||
else {
|
||||
e = new Error(helpfulMessage);
|
||||
e.code = res.status.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Compute = Compute;
|
||||
//# sourceMappingURL=computeclient.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/computeclient.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/computeclient.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"computeclient.js","sourceRoot":"","sources":["../../../src/auth/computeclient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;AAGH,4CAA4C;AAC5C,wCAAwC;AAExC,iDAA8E;AAU9E,MAAa,OAAQ,SAAQ,2BAAY;IAGvC;;;;;OAKG;IACH,YAAY,UAA0B,EAAE;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,mEAAmE;QACnE,+CAA+C;QAC/C,IAAI,CAAC,WAAW,GAAG,EAAC,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAC,CAAC;QAC1E,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,SAAS,CAAC;IACtE,CAAC;IAED;;;;;OAKG;IACH,oBAAoB;QAClB,oEAAoE;QACpE,uEAAuE;QACvE,SAAS;QACT,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACa,mBAAmB,CAAC,YACI;;YACtC,MAAM,SAAS,GAAG,oBAAoB,IAAI,CAAC,mBAAmB,QAAQ,CAAC;YACvE,IAAI,GAAqC,CAAC;YAC1C,IAAI;gBACF,GAAG,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;aAC7C;YAAC,OAAO,CAAC,EAAE;gBACV,CAAC,CAAC,OAAO,GAAG,iCAAiC,CAAC;gBAC9C,MAAM,CAAC,CAAC;aACT;YACD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAmB,CAAC;YACvC,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE;gBACnC,MAAM,CAAC,WAAW;oBACd,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;gBAC5D,OAAQ,MAA4B,CAAC,UAAU,CAAC;aACjD;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5B,OAAO,EAAC,MAAM,EAAE,GAAG,EAAC,CAAC;QACvB,CAAC;KAAA;IAES,YAAY,CAAI,IAAwB,EAAE,KAAK,GAAG,KAAK;QAE/D,OAAO,KAAK,CAAC,YAAY,CAAI,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YAClD,MAAM,GAAG,GAAI,CAAgB,CAAC,QAAQ,CAAC;YACvC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE;gBACrB,IAAI,cAAc,GAAG,IAAI,CAAC;gBAC1B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;oBACtB,cAAc;wBACV,wEAAwE;4BACxE,yFAAyF;4BACzF,wEAAwE,CAAC;iBAC9E;qBAAM,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;oBAC7B,cAAc;wBACV,uEAAuE;4BACvE,yFAAyF;4BACzF,gEAAgE,CAAC;iBACtE;gBACD,IAAI,cAAc,EAAE;oBAClB,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE;wBAC5B,cAAc,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC;qBACnC;oBACD,IAAI,CAAC,EAAE;wBACL,CAAC,CAAC,OAAO,GAAG,cAAc,CAAC;qBAC5B;yBAAM;wBACL,CAAC,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;wBAC7B,CAA2B,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;qBAC3D;iBACF;aACF;YACD,MAAM,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvFD,0BAuFC"}
|
43
express-server/node_modules/google-auth-library/build/src/auth/credentials.d.ts
generated
vendored
Normal file
43
express-server/node_modules/google-auth-library/build/src/auth/credentials.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export interface Credentials {
|
||||
refresh_token?: string | null;
|
||||
expiry_date?: number | null;
|
||||
access_token?: string | null;
|
||||
token_type?: string | null;
|
||||
id_token?: string | null;
|
||||
}
|
||||
export interface CredentialRequest {
|
||||
refresh_token?: string;
|
||||
access_token?: string;
|
||||
token_type?: string;
|
||||
expires_in?: number;
|
||||
id_token?: string;
|
||||
}
|
||||
export interface JWTInput {
|
||||
type?: string;
|
||||
client_email?: string;
|
||||
private_key?: string;
|
||||
private_key_id?: string;
|
||||
project_id?: string;
|
||||
client_id?: string;
|
||||
client_secret?: string;
|
||||
refresh_token?: string;
|
||||
}
|
||||
export interface CredentialBody {
|
||||
client_email?: string;
|
||||
private_key?: string;
|
||||
}
|
18
express-server/node_modules/google-auth-library/build/src/auth/credentials.js
generated
vendored
Normal file
18
express-server/node_modules/google-auth-library/build/src/auth/credentials.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
//# sourceMappingURL=credentials.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/credentials.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/credentials.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/auth/credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
24
express-server/node_modules/google-auth-library/build/src/auth/envDetect.d.ts
generated
vendored
Normal file
24
express-server/node_modules/google-auth-library/build/src/auth/envDetect.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright 2018 Google LLC. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export declare enum GCPEnv {
|
||||
APP_ENGINE = "APP_ENGINE",
|
||||
KUBERNETES_ENGINE = "KUBERNETES_ENGINE",
|
||||
CLOUD_FUNCTIONS = "CLOUD_FUNCTIONS",
|
||||
COMPUTE_ENGINE = "COMPUTE_ENGINE",
|
||||
NONE = "NONE"
|
||||
}
|
||||
export declare function clear(): void;
|
||||
export declare function getEnv(): Promise<GCPEnv>;
|
85
express-server/node_modules/google-auth-library/build/src/auth/envDetect.js
generated
vendored
Normal file
85
express-server/node_modules/google-auth-library/build/src/auth/envDetect.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2018 Google LLC. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const gcpMetadata = require("gcp-metadata");
|
||||
var GCPEnv;
|
||||
(function (GCPEnv) {
|
||||
GCPEnv["APP_ENGINE"] = "APP_ENGINE";
|
||||
GCPEnv["KUBERNETES_ENGINE"] = "KUBERNETES_ENGINE";
|
||||
GCPEnv["CLOUD_FUNCTIONS"] = "CLOUD_FUNCTIONS";
|
||||
GCPEnv["COMPUTE_ENGINE"] = "COMPUTE_ENGINE";
|
||||
GCPEnv["NONE"] = "NONE";
|
||||
})(GCPEnv = exports.GCPEnv || (exports.GCPEnv = {}));
|
||||
let env;
|
||||
function clear() {
|
||||
env = undefined;
|
||||
}
|
||||
exports.clear = clear;
|
||||
function getEnv() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!env) {
|
||||
if (isAppEngine()) {
|
||||
env = GCPEnv.APP_ENGINE;
|
||||
}
|
||||
else if (isCloudFunction()) {
|
||||
env = GCPEnv.CLOUD_FUNCTIONS;
|
||||
}
|
||||
else if (yield isKubernetesEngine()) {
|
||||
env = GCPEnv.KUBERNETES_ENGINE;
|
||||
}
|
||||
else if (yield isComputeEngine()) {
|
||||
env = GCPEnv.COMPUTE_ENGINE;
|
||||
}
|
||||
else {
|
||||
env = GCPEnv.NONE;
|
||||
}
|
||||
}
|
||||
return env;
|
||||
});
|
||||
}
|
||||
exports.getEnv = getEnv;
|
||||
function isAppEngine() {
|
||||
return !!(process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME);
|
||||
}
|
||||
function isCloudFunction() {
|
||||
return !!process.env.FUNCTION_NAME;
|
||||
}
|
||||
function isKubernetesEngine() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield gcpMetadata.instance('attributes/cluster-name');
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function isComputeEngine() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return gcpMetadata.isAvailable();
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=envDetect.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/envDetect.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/envDetect.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"envDetect.js","sourceRoot":"","sources":["../../../src/auth/envDetect.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;AAEH,4CAA4C;AAE5C,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,mCAAyB,CAAA;IACzB,iDAAuC,CAAA;IACvC,6CAAmC,CAAA;IACnC,2CAAiC,CAAA;IACjC,uBAAa,CAAA;AACf,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAED,IAAI,GAAqB,CAAC;AAE1B,SAAgB,KAAK;IACnB,GAAG,GAAG,SAAS,CAAC;AAClB,CAAC;AAFD,sBAEC;AAED,SAAsB,MAAM;;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,IAAI,WAAW,EAAE,EAAE;gBACjB,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;aACzB;iBAAM,IAAI,eAAe,EAAE,EAAE;gBAC5B,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC;aAC9B;iBAAM,IAAI,MAAM,kBAAkB,EAAE,EAAE;gBACrC,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;aAChC;iBAAM,IAAI,MAAM,eAAe,EAAE,EAAE;gBAClC,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC;aAC7B;iBAAM;gBACL,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;aACnB;SACF;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CAAA;AAfD,wBAeC;AAED,SAAS,WAAW;IAClB,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AACrC,CAAC;AAED,SAAe,kBAAkB;;QAC/B,IAAI;YACF,MAAM,WAAW,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAAA;AAED,SAAe,eAAe;;QAC5B,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC;CAAA"}
|
272
express-server/node_modules/google-auth-library/build/src/auth/googleauth.d.ts
generated
vendored
Normal file
272
express-server/node_modules/google-auth-library/build/src/auth/googleauth.d.ts
generated
vendored
Normal file
@ -0,0 +1,272 @@
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import * as fs from 'fs';
|
||||
import * as stream from 'stream';
|
||||
import { DefaultTransporter, Transporter } from '../transporters';
|
||||
import { Compute } from './computeclient';
|
||||
import { CredentialBody, JWTInput } from './credentials';
|
||||
import { GCPEnv } from './envDetect';
|
||||
import { JWT } from './jwtclient';
|
||||
import { Headers, OAuth2Client, RefreshOptions } from './oauth2client';
|
||||
import { UserRefreshClient } from './refreshclient';
|
||||
export interface ProjectIdCallback {
|
||||
(err?: Error | null, projectId?: string | null): void;
|
||||
}
|
||||
export interface CredentialCallback {
|
||||
(err: Error | null, result?: UserRefreshClient | JWT): void;
|
||||
}
|
||||
export interface ADCCallback {
|
||||
(err: Error | null, credential?: OAuth2Client, projectId?: string | null): void;
|
||||
}
|
||||
export interface ADCResponse {
|
||||
credential: OAuth2Client;
|
||||
projectId: string | null;
|
||||
}
|
||||
export interface GoogleAuthOptions {
|
||||
/**
|
||||
* Path to a .json, .pem, or .p12 key file
|
||||
*/
|
||||
keyFilename?: string;
|
||||
/**
|
||||
* Path to a .json, .pem, or .p12 key file
|
||||
*/
|
||||
keyFile?: string;
|
||||
/**
|
||||
* Object containing client_email and private_key properties
|
||||
*/
|
||||
credentials?: CredentialBody;
|
||||
/**
|
||||
* Required scopes for the desired API request
|
||||
*/
|
||||
scopes?: string | string[];
|
||||
/**
|
||||
* Your project ID.
|
||||
*/
|
||||
projectId?: string;
|
||||
}
|
||||
export declare const CLOUD_SDK_CLIENT_ID = "764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";
|
||||
export declare class GoogleAuth {
|
||||
transporter?: Transporter;
|
||||
/**
|
||||
* Caches a value indicating whether the auth layer is running on Google
|
||||
* Compute Engine.
|
||||
* @private
|
||||
*/
|
||||
private checkIsGCE?;
|
||||
readonly isGCE: boolean | undefined;
|
||||
private _getDefaultProjectIdPromise?;
|
||||
private _cachedProjectId?;
|
||||
jsonContent: JWTInput | null;
|
||||
cachedCredential: JWT | UserRefreshClient | Compute | null;
|
||||
private keyFilename?;
|
||||
private scopes?;
|
||||
/**
|
||||
* Export DefaultTransporter as a static property of the class.
|
||||
*/
|
||||
static DefaultTransporter: typeof DefaultTransporter;
|
||||
constructor(opts?: GoogleAuthOptions);
|
||||
/**
|
||||
* THIS METHOD HAS BEEN DEPRECATED.
|
||||
* It will be removed in 3.0. Please use getProjectId instead.
|
||||
*/
|
||||
getDefaultProjectId(): Promise<string>;
|
||||
getDefaultProjectId(callback: ProjectIdCallback): void;
|
||||
/**
|
||||
* Obtains the default project ID for the application.
|
||||
* @param callback Optional callback
|
||||
* @returns Promise that resolves with project Id (if used without callback)
|
||||
*/
|
||||
getProjectId(): Promise<string>;
|
||||
getProjectId(callback: ProjectIdCallback): void;
|
||||
private getProjectIdAsync;
|
||||
/**
|
||||
* Obtains the default service-level credentials for the application.
|
||||
* @param callback Optional callback.
|
||||
* @returns Promise that resolves with the ADCResponse (if no callback was
|
||||
* passed).
|
||||
*/
|
||||
getApplicationDefault(): Promise<ADCResponse>;
|
||||
getApplicationDefault(callback: ADCCallback): void;
|
||||
getApplicationDefault(options: RefreshOptions): Promise<ADCResponse>;
|
||||
getApplicationDefault(options: RefreshOptions, callback: ADCCallback): void;
|
||||
private getApplicationDefaultAsync;
|
||||
/**
|
||||
* Determines whether the auth layer is running on Google Compute Engine.
|
||||
* @returns A promise that resolves with the boolean.
|
||||
* @api private
|
||||
*/
|
||||
_checkIsGCE(): Promise<boolean>;
|
||||
/**
|
||||
* Attempts to load default credentials from the environment variable path..
|
||||
* @returns Promise that resolves with the OAuth2Client or null.
|
||||
* @api private
|
||||
*/
|
||||
_tryGetApplicationCredentialsFromEnvironmentVariable(options?: RefreshOptions): Promise<JWT | UserRefreshClient | null>;
|
||||
/**
|
||||
* Attempts to load default credentials from a well-known file location
|
||||
* @return Promise that resolves with the OAuth2Client or null.
|
||||
* @api private
|
||||
*/
|
||||
_tryGetApplicationCredentialsFromWellKnownFile(options?: RefreshOptions): Promise<JWT | UserRefreshClient | null>;
|
||||
/**
|
||||
* Attempts to load default credentials from a file at the given path..
|
||||
* @param filePath The path to the file to read.
|
||||
* @returns Promise that resolves with the OAuth2Client
|
||||
* @api private
|
||||
*/
|
||||
_getApplicationCredentialsFromFilePath(filePath: string, options?: RefreshOptions): Promise<JWT | UserRefreshClient>;
|
||||
/**
|
||||
* Credentials from the Cloud SDK that are associated with Cloud SDK's project
|
||||
* are problematic because they may not have APIs enabled and have limited
|
||||
* quota. If this is the case, warn about it.
|
||||
*/
|
||||
protected warnOnProblematicCredentials(client: JWT): void;
|
||||
/**
|
||||
* Create a credentials instance using the given input options.
|
||||
* @param json The input object.
|
||||
* @returns JWT or UserRefresh Client with data
|
||||
*/
|
||||
fromJSON(json: JWTInput, options?: RefreshOptions): JWT | UserRefreshClient;
|
||||
/**
|
||||
* Create a credentials instance using the given input stream.
|
||||
* @param inputStream The input stream.
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
fromStream(inputStream: stream.Readable): Promise<JWT | UserRefreshClient>;
|
||||
fromStream(inputStream: stream.Readable, callback: CredentialCallback): void;
|
||||
fromStream(inputStream: stream.Readable, options: RefreshOptions): Promise<JWT | UserRefreshClient>;
|
||||
fromStream(inputStream: stream.Readable, options: RefreshOptions, callback: CredentialCallback): void;
|
||||
private fromStreamAsync;
|
||||
/**
|
||||
* Create a credentials instance using the given API key string.
|
||||
* @param apiKey The API key string
|
||||
* @param options An optional options object.
|
||||
* @returns A JWT loaded from the key
|
||||
*/
|
||||
fromAPIKey(apiKey: string, options?: RefreshOptions): JWT;
|
||||
/**
|
||||
* Determines whether the current operating system is Windows.
|
||||
* @api private
|
||||
*/
|
||||
private _isWindows;
|
||||
/**
|
||||
* Creates a file stream. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_createReadStream(filePath: string): fs.ReadStream;
|
||||
/**
|
||||
* Gets the current operating system platform. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_osPlatform(): NodeJS.Platform;
|
||||
/**
|
||||
* Determines whether a file exists. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_fileExists(filePath: string): boolean;
|
||||
/**
|
||||
* Joins two parts of a path. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_pathJoin(item1: string, item2: string): string;
|
||||
/**
|
||||
* Allows mocking of the path to a well-known file.
|
||||
* @api private
|
||||
*/
|
||||
_mockWellKnownFilePath(filePath: string): string;
|
||||
private createError;
|
||||
/**
|
||||
* Run the Google Cloud SDK command that prints the default project ID
|
||||
*/
|
||||
private getDefaultServiceProjectId;
|
||||
/**
|
||||
* Loads the project id from environment variables.
|
||||
* @api private
|
||||
*/
|
||||
private getProductionProjectId;
|
||||
/**
|
||||
* Loads the project id from the GOOGLE_APPLICATION_CREDENTIALS json file.
|
||||
* @api private
|
||||
*/
|
||||
private getFileProjectId;
|
||||
/**
|
||||
* Gets the Compute Engine project ID if it can be inferred.
|
||||
*/
|
||||
private getGCEProjectId;
|
||||
/**
|
||||
* The callback function handles a credential object that contains the
|
||||
* client_email and private_key (if exists).
|
||||
* getCredentials checks for these values from the user JSON at first.
|
||||
* If it doesn't exist, and the environment is on GCE, it gets the
|
||||
* client_email from the cloud metadata server.
|
||||
* @param callback Callback that handles the credential object that contains
|
||||
* a client_email and optional private key, or the error.
|
||||
* returned
|
||||
*/
|
||||
getCredentials(): Promise<CredentialBody>;
|
||||
getCredentials(callback: (err: Error | null, credentials?: CredentialBody) => void): void;
|
||||
private getCredentialsAsync;
|
||||
/**
|
||||
* Automatically obtain a client based on the provided configuration. If no
|
||||
* options were passed, use Application Default Credentials.
|
||||
*/
|
||||
getClient(options?: GoogleAuthOptions): Promise<Compute | JWT | UserRefreshClient>;
|
||||
/**
|
||||
* Automatically obtain application default credentials, and return
|
||||
* an access token for making requests.
|
||||
*/
|
||||
getAccessToken(): Promise<string | null | undefined>;
|
||||
/**
|
||||
* Obtain the HTTP headers that will provide authorization for a given
|
||||
* request.
|
||||
*/
|
||||
getRequestHeaders(url?: string): Promise<Headers>;
|
||||
/**
|
||||
* Obtain credentials for a request, then attach the appropriate headers to
|
||||
* the request options.
|
||||
* @param opts Axios or Request options on which to attach the headers
|
||||
*/
|
||||
authorizeRequest(opts: {
|
||||
url?: string;
|
||||
uri?: string;
|
||||
headers?: Headers;
|
||||
}): Promise<{
|
||||
url?: string | undefined;
|
||||
uri?: string | undefined;
|
||||
headers?: Headers | undefined;
|
||||
}>;
|
||||
/**
|
||||
* Automatically obtain application default credentials, and make an
|
||||
* HTTP request using the given options.
|
||||
* @param opts Axios request options for the HTTP request.
|
||||
*/
|
||||
request<T = any>(opts: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
||||
/**
|
||||
* Determine the compute environment in which the code is running.
|
||||
*/
|
||||
getEnv(): Promise<GCPEnv>;
|
||||
/**
|
||||
* Sign the given data with the current private key, or go out
|
||||
* to the IAM API to sign it.
|
||||
* @param data The data to be signed.
|
||||
*/
|
||||
sign(data: string): Promise<string>;
|
||||
}
|
||||
export interface SignBlobResponse {
|
||||
signature: string;
|
||||
}
|
641
express-server/node_modules/google-auth-library/build/src/auth/googleauth.js
generated
vendored
Normal file
641
express-server/node_modules/google-auth-library/build/src/auth/googleauth.js
generated
vendored
Normal file
@ -0,0 +1,641 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const child_process_1 = require("child_process");
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const gcpMetadata = require("gcp-metadata");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const util = require("util");
|
||||
const messages = require("../messages");
|
||||
const transporters_1 = require("../transporters");
|
||||
const computeclient_1 = require("./computeclient");
|
||||
const envDetect_1 = require("./envDetect");
|
||||
const jwtclient_1 = require("./jwtclient");
|
||||
const refreshclient_1 = require("./refreshclient");
|
||||
exports.CLOUD_SDK_CLIENT_ID = '764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com';
|
||||
class GoogleAuth {
|
||||
constructor(opts) {
|
||||
/**
|
||||
* Caches a value indicating whether the auth layer is running on Google
|
||||
* Compute Engine.
|
||||
* @private
|
||||
*/
|
||||
this.checkIsGCE = undefined;
|
||||
// To save the contents of the JSON credential file
|
||||
this.jsonContent = null;
|
||||
this.cachedCredential = null;
|
||||
opts = opts || {};
|
||||
this._cachedProjectId = opts.projectId || null;
|
||||
this.keyFilename = opts.keyFilename || opts.keyFile;
|
||||
this.scopes = opts.scopes;
|
||||
this.jsonContent = opts.credentials || null;
|
||||
}
|
||||
// Note: this properly is only public to satisify unit tests.
|
||||
// https://github.com/Microsoft/TypeScript/issues/5228
|
||||
get isGCE() {
|
||||
return this.checkIsGCE;
|
||||
}
|
||||
getDefaultProjectId(callback) {
|
||||
messages.warn(messages.DEFAULT_PROJECT_ID_DEPRECATED);
|
||||
if (callback) {
|
||||
this.getProjectIdAsync().then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.getProjectIdAsync();
|
||||
}
|
||||
}
|
||||
getProjectId(callback) {
|
||||
if (callback) {
|
||||
this.getProjectIdAsync().then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.getProjectIdAsync();
|
||||
}
|
||||
}
|
||||
getProjectIdAsync() {
|
||||
if (this._cachedProjectId) {
|
||||
return Promise.resolve(this._cachedProjectId);
|
||||
}
|
||||
// In implicit case, supports three environments. In order of precedence,
|
||||
// the implicit environments are:
|
||||
// - GCLOUD_PROJECT or GOOGLE_CLOUD_PROJECT environment variable
|
||||
// - GOOGLE_APPLICATION_CREDENTIALS JSON file
|
||||
// - Cloud SDK: `gcloud config config-helper --format json`
|
||||
// - GCE project ID from metadata server)
|
||||
if (!this._getDefaultProjectIdPromise) {
|
||||
this._getDefaultProjectIdPromise =
|
||||
new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const projectId = this.getProductionProjectId() ||
|
||||
(yield this.getFileProjectId()) ||
|
||||
(yield this.getDefaultServiceProjectId()) ||
|
||||
(yield this.getGCEProjectId());
|
||||
this._cachedProjectId = projectId;
|
||||
resolve(projectId);
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
return this._getDefaultProjectIdPromise;
|
||||
}
|
||||
getApplicationDefault(optionsOrCallback = {}, callback) {
|
||||
let options;
|
||||
if (typeof optionsOrCallback === 'function') {
|
||||
callback = optionsOrCallback;
|
||||
}
|
||||
else {
|
||||
options = optionsOrCallback;
|
||||
}
|
||||
if (callback) {
|
||||
this.getApplicationDefaultAsync(options).then(r => callback(null, r.credential, r.projectId), callback);
|
||||
}
|
||||
else {
|
||||
return this.getApplicationDefaultAsync(options);
|
||||
}
|
||||
}
|
||||
getApplicationDefaultAsync(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// If we've already got a cached credential, just return it.
|
||||
if (this.cachedCredential) {
|
||||
return {
|
||||
credential: this.cachedCredential,
|
||||
projectId: yield this.getProjectIdAsync()
|
||||
};
|
||||
}
|
||||
let credential;
|
||||
let projectId;
|
||||
// Check for the existence of a local environment variable pointing to the
|
||||
// location of the credential file. This is typically used in local
|
||||
// developer scenarios.
|
||||
credential =
|
||||
yield this._tryGetApplicationCredentialsFromEnvironmentVariable(options);
|
||||
if (credential) {
|
||||
if (credential instanceof jwtclient_1.JWT) {
|
||||
credential.scopes = this.scopes;
|
||||
}
|
||||
this.cachedCredential = credential;
|
||||
projectId = yield this.getProjectId();
|
||||
return { credential, projectId };
|
||||
}
|
||||
// Look in the well-known credential file location.
|
||||
credential =
|
||||
yield this._tryGetApplicationCredentialsFromWellKnownFile(options);
|
||||
if (credential) {
|
||||
if (credential instanceof jwtclient_1.JWT) {
|
||||
credential.scopes = this.scopes;
|
||||
}
|
||||
this.cachedCredential = credential;
|
||||
projectId = yield this.getProjectId();
|
||||
return { credential, projectId };
|
||||
}
|
||||
// Determine if we're running on GCE.
|
||||
let isGCE;
|
||||
try {
|
||||
isGCE = yield this._checkIsGCE();
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error('Unexpected error determining execution environment: ' + e.message);
|
||||
}
|
||||
if (!isGCE) {
|
||||
// We failed to find the default credentials. Bail out with an error.
|
||||
throw new Error('Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.');
|
||||
}
|
||||
// For GCE, just return a default ComputeClient. It will take care of
|
||||
// the rest.
|
||||
this.cachedCredential = new computeclient_1.Compute(options);
|
||||
projectId = yield this.getProjectId();
|
||||
return { projectId, credential: this.cachedCredential };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Determines whether the auth layer is running on Google Compute Engine.
|
||||
* @returns A promise that resolves with the boolean.
|
||||
* @api private
|
||||
*/
|
||||
_checkIsGCE() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.checkIsGCE === undefined) {
|
||||
this.checkIsGCE = yield gcpMetadata.isAvailable();
|
||||
}
|
||||
return this.checkIsGCE;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to load default credentials from the environment variable path..
|
||||
* @returns Promise that resolves with the OAuth2Client or null.
|
||||
* @api private
|
||||
*/
|
||||
_tryGetApplicationCredentialsFromEnvironmentVariable(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const credentialsPath = process.env['GOOGLE_APPLICATION_CREDENTIALS'];
|
||||
if (!credentialsPath || credentialsPath.length === 0) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return this._getApplicationCredentialsFromFilePath(credentialsPath, options);
|
||||
}
|
||||
catch (e) {
|
||||
throw this.createError('Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to load default credentials from a well-known file location
|
||||
* @return Promise that resolves with the OAuth2Client or null.
|
||||
* @api private
|
||||
*/
|
||||
_tryGetApplicationCredentialsFromWellKnownFile(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// First, figure out the location of the file, depending upon the OS type.
|
||||
let location = null;
|
||||
if (this._isWindows()) {
|
||||
// Windows
|
||||
location = process.env['APPDATA'];
|
||||
}
|
||||
else {
|
||||
// Linux or Mac
|
||||
const home = process.env['HOME'];
|
||||
if (home) {
|
||||
location = this._pathJoin(home, '.config');
|
||||
}
|
||||
}
|
||||
// If we found the root path, expand it.
|
||||
if (location) {
|
||||
location = this._pathJoin(location, 'gcloud');
|
||||
location =
|
||||
this._pathJoin(location, 'application_default_credentials.json');
|
||||
location = this._mockWellKnownFilePath(location);
|
||||
// Check whether the file exists.
|
||||
if (!this._fileExists(location)) {
|
||||
location = null;
|
||||
}
|
||||
}
|
||||
// The file does not exist.
|
||||
if (!location) {
|
||||
return null;
|
||||
}
|
||||
// The file seems to exist. Try to use it.
|
||||
const client = yield this._getApplicationCredentialsFromFilePath(location, options);
|
||||
this.warnOnProblematicCredentials(client);
|
||||
return client;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to load default credentials from a file at the given path..
|
||||
* @param filePath The path to the file to read.
|
||||
* @returns Promise that resolves with the OAuth2Client
|
||||
* @api private
|
||||
*/
|
||||
_getApplicationCredentialsFromFilePath(filePath, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Make sure the path looks like a string.
|
||||
if (!filePath || filePath.length === 0) {
|
||||
throw new Error('The file path is invalid.');
|
||||
}
|
||||
// Make sure there is a file at the path. lstatSync will throw if there is
|
||||
// nothing there.
|
||||
try {
|
||||
// Resolve path to actual file in case of symlink. Expect a thrown error
|
||||
// if not resolvable.
|
||||
filePath = fs.realpathSync(filePath);
|
||||
if (!fs.lstatSync(filePath).isFile()) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
throw this.createError(util.format('The file at %s does not exist, or it is not a file.', filePath), err);
|
||||
}
|
||||
// Now open a read stream on the file, and parse it.
|
||||
try {
|
||||
const readStream = this._createReadStream(filePath);
|
||||
return this.fromStream(readStream, options);
|
||||
}
|
||||
catch (err) {
|
||||
throw this.createError(util.format('Unable to read the file at %s.', filePath), err);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Credentials from the Cloud SDK that are associated with Cloud SDK's project
|
||||
* are problematic because they may not have APIs enabled and have limited
|
||||
* quota. If this is the case, warn about it.
|
||||
*/
|
||||
warnOnProblematicCredentials(client) {
|
||||
if (client.email === exports.CLOUD_SDK_CLIENT_ID) {
|
||||
messages.warn(messages.PROBLEMATIC_CREDENTIALS_WARNING);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a credentials instance using the given input options.
|
||||
* @param json The input object.
|
||||
* @returns JWT or UserRefresh Client with data
|
||||
*/
|
||||
fromJSON(json, options) {
|
||||
let client;
|
||||
if (!json) {
|
||||
throw new Error('Must pass in a JSON object containing the Google auth settings.');
|
||||
}
|
||||
this.jsonContent = json;
|
||||
options = options || {};
|
||||
if (json.type === 'authorized_user') {
|
||||
client = new refreshclient_1.UserRefreshClient(options);
|
||||
}
|
||||
else {
|
||||
options.scopes = this.scopes;
|
||||
client = new jwtclient_1.JWT(options);
|
||||
}
|
||||
client.fromJSON(json);
|
||||
return client;
|
||||
}
|
||||
fromStream(inputStream, optionsOrCallback = {}, callback) {
|
||||
let options = {};
|
||||
if (typeof optionsOrCallback === 'function') {
|
||||
callback = optionsOrCallback;
|
||||
}
|
||||
else {
|
||||
options = optionsOrCallback;
|
||||
}
|
||||
if (callback) {
|
||||
this.fromStreamAsync(inputStream, options)
|
||||
.then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.fromStreamAsync(inputStream, options);
|
||||
}
|
||||
}
|
||||
fromStreamAsync(inputStream, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!inputStream) {
|
||||
throw new Error('Must pass in a stream containing the Google auth settings.');
|
||||
}
|
||||
let s = '';
|
||||
inputStream.setEncoding('utf8')
|
||||
.on('error', reject)
|
||||
.on('data', (chunk) => s += chunk)
|
||||
.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(s);
|
||||
const r = this.fromJSON(data, options);
|
||||
return resolve(r);
|
||||
}
|
||||
catch (err) {
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create a credentials instance using the given API key string.
|
||||
* @param apiKey The API key string
|
||||
* @param options An optional options object.
|
||||
* @returns A JWT loaded from the key
|
||||
*/
|
||||
fromAPIKey(apiKey, options) {
|
||||
options = options || {};
|
||||
const client = new jwtclient_1.JWT(options);
|
||||
client.fromAPIKey(apiKey);
|
||||
return client;
|
||||
}
|
||||
/**
|
||||
* Determines whether the current operating system is Windows.
|
||||
* @api private
|
||||
*/
|
||||
_isWindows() {
|
||||
const sys = this._osPlatform();
|
||||
if (sys && sys.length >= 3) {
|
||||
if (sys.substring(0, 3).toLowerCase() === 'win') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Creates a file stream. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_createReadStream(filePath) {
|
||||
return fs.createReadStream(filePath);
|
||||
}
|
||||
/**
|
||||
* Gets the current operating system platform. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_osPlatform() {
|
||||
return os.platform();
|
||||
}
|
||||
/**
|
||||
* Determines whether a file exists. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_fileExists(filePath) {
|
||||
return fs.existsSync(filePath);
|
||||
}
|
||||
/**
|
||||
* Joins two parts of a path. Allows mocking.
|
||||
* @api private
|
||||
*/
|
||||
_pathJoin(item1, item2) {
|
||||
return path.join(item1, item2);
|
||||
}
|
||||
/**
|
||||
* Allows mocking of the path to a well-known file.
|
||||
* @api private
|
||||
*/
|
||||
_mockWellKnownFilePath(filePath) {
|
||||
return filePath;
|
||||
}
|
||||
// Creates an Error containing the given message, and includes the message
|
||||
// from the optional err passed in.
|
||||
createError(message, err) {
|
||||
let s = message || '';
|
||||
if (err) {
|
||||
const errorMessage = String(err);
|
||||
if (errorMessage && errorMessage.length > 0) {
|
||||
if (s.length > 0) {
|
||||
s += ' ';
|
||||
}
|
||||
s += errorMessage;
|
||||
}
|
||||
}
|
||||
return Error(s);
|
||||
}
|
||||
/**
|
||||
* Run the Google Cloud SDK command that prints the default project ID
|
||||
*/
|
||||
getDefaultServiceProjectId() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise(resolve => {
|
||||
child_process_1.exec('gcloud config config-helper --format json', (err, stdout, stderr) => {
|
||||
if (!err && stdout) {
|
||||
try {
|
||||
const projectId = JSON.parse(stdout).configuration.properties.core.project;
|
||||
resolve(projectId);
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
// ignore errors
|
||||
}
|
||||
}
|
||||
resolve(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Loads the project id from environment variables.
|
||||
* @api private
|
||||
*/
|
||||
getProductionProjectId() {
|
||||
return process.env['GCLOUD_PROJECT'] || process.env['GOOGLE_CLOUD_PROJECT'];
|
||||
}
|
||||
/**
|
||||
* Loads the project id from the GOOGLE_APPLICATION_CREDENTIALS json file.
|
||||
* @api private
|
||||
*/
|
||||
getFileProjectId() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.cachedCredential) {
|
||||
// Try to read the project ID from the cached credentials file
|
||||
return this.cachedCredential.projectId;
|
||||
}
|
||||
// Try to load a credentials file and read its project ID
|
||||
const r = yield this._tryGetApplicationCredentialsFromEnvironmentVariable();
|
||||
if (r) {
|
||||
return r.projectId;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Gets the Compute Engine project ID if it can be inferred.
|
||||
*/
|
||||
getGCEProjectId() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const r = yield gcpMetadata.project('project-id');
|
||||
return r.data;
|
||||
}
|
||||
catch (e) {
|
||||
// Ignore any errors
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
getCredentials(callback) {
|
||||
if (callback) {
|
||||
this.getCredentialsAsync().then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.getCredentialsAsync();
|
||||
}
|
||||
}
|
||||
getCredentialsAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.jsonContent) {
|
||||
const credential = {
|
||||
client_email: this.jsonContent.client_email,
|
||||
private_key: this.jsonContent.private_key
|
||||
};
|
||||
return credential;
|
||||
}
|
||||
const isGCE = yield this._checkIsGCE();
|
||||
if (!isGCE) {
|
||||
throw new Error('Unknown error.');
|
||||
}
|
||||
// For GCE, return the service account details from the metadata server
|
||||
// NOTE: The trailing '/' at the end of service-accounts/ is very important!
|
||||
// The GCF metadata server doesn't respect querystring params if this / is
|
||||
// not included.
|
||||
const { data } = yield gcpMetadata.instance({ property: 'service-accounts/', params: { recursive: true } });
|
||||
if (!data || !data.default || !data.default.email) {
|
||||
throw new Error('Failure from metadata server.');
|
||||
}
|
||||
return { client_email: data.default.email };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Automatically obtain a client based on the provided configuration. If no
|
||||
* options were passed, use Application Default Credentials.
|
||||
*/
|
||||
getClient(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (options) {
|
||||
this.keyFilename =
|
||||
options.keyFilename || options.keyFile || this.keyFilename;
|
||||
this.scopes = options.scopes || this.scopes;
|
||||
this.jsonContent = options.credentials || this.jsonContent;
|
||||
}
|
||||
if (!this.cachedCredential) {
|
||||
if (this.jsonContent) {
|
||||
this.cachedCredential = yield this.fromJSON(this.jsonContent);
|
||||
}
|
||||
else if (this.keyFilename) {
|
||||
const filePath = path.resolve(this.keyFilename);
|
||||
const stream = fs.createReadStream(filePath);
|
||||
this.cachedCredential = yield this.fromStreamAsync(stream);
|
||||
}
|
||||
else {
|
||||
yield this.getApplicationDefaultAsync();
|
||||
}
|
||||
}
|
||||
return this.cachedCredential;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Automatically obtain application default credentials, and return
|
||||
* an access token for making requests.
|
||||
*/
|
||||
getAccessToken() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = yield this.getClient();
|
||||
return (yield client.getAccessToken()).token;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Obtain the HTTP headers that will provide authorization for a given
|
||||
* request.
|
||||
*/
|
||||
getRequestHeaders(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = yield this.getClient();
|
||||
return client.getRequestHeaders(url);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Obtain credentials for a request, then attach the appropriate headers to
|
||||
* the request options.
|
||||
* @param opts Axios or Request options on which to attach the headers
|
||||
*/
|
||||
authorizeRequest(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
opts = opts || {};
|
||||
const url = opts.url || opts.uri;
|
||||
const client = yield this.getClient();
|
||||
const headers = yield client.getRequestHeaders(url);
|
||||
opts.headers = Object.assign(opts.headers || {}, headers);
|
||||
return opts;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Automatically obtain application default credentials, and make an
|
||||
* HTTP request using the given options.
|
||||
* @param opts Axios request options for the HTTP request.
|
||||
*/
|
||||
// tslint:disable-next-line no-any
|
||||
request(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = yield this.getClient();
|
||||
return client.request(opts);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Determine the compute environment in which the code is running.
|
||||
*/
|
||||
getEnv() {
|
||||
return envDetect_1.getEnv();
|
||||
}
|
||||
/**
|
||||
* Sign the given data with the current private key, or go out
|
||||
* to the IAM API to sign it.
|
||||
* @param data The data to be signed.
|
||||
*/
|
||||
sign(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = yield this.getClient();
|
||||
if (client instanceof jwtclient_1.JWT && client.key) {
|
||||
const sign = crypto.createSign('RSA-SHA256');
|
||||
sign.update(data);
|
||||
return sign.sign(client.key, 'base64');
|
||||
}
|
||||
const projectId = yield this.getProjectId();
|
||||
if (!projectId) {
|
||||
throw new Error('Cannot sign data without a project ID.');
|
||||
}
|
||||
const creds = yield this.getCredentials();
|
||||
if (!creds.client_email) {
|
||||
throw new Error('Cannot sign data without `client_email`.');
|
||||
}
|
||||
const id = `projects/${projectId}/serviceAccounts/${creds.client_email}`;
|
||||
const res = yield this.request({
|
||||
method: 'POST',
|
||||
url: `https://iam.googleapis.com/v1/${id}:signBlob`,
|
||||
data: { bytesToSign: Buffer.from(data).toString('base64') }
|
||||
});
|
||||
return res.data.signature;
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Export DefaultTransporter as a static property of the class.
|
||||
*/
|
||||
GoogleAuth.DefaultTransporter = transporters_1.DefaultTransporter;
|
||||
exports.GoogleAuth = GoogleAuth;
|
||||
//# sourceMappingURL=googleauth.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/googleauth.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/googleauth.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
53
express-server/node_modules/google-auth-library/build/src/auth/iam.d.ts
generated
vendored
Normal file
53
express-server/node_modules/google-auth-library/build/src/auth/iam.d.ts
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export interface RequestMetadata {
|
||||
'x-goog-iam-authority-selector': string;
|
||||
'x-goog-iam-authorization-token': string;
|
||||
}
|
||||
export declare class IAMAuth {
|
||||
selector: string;
|
||||
token: string;
|
||||
/**
|
||||
* IAM credentials.
|
||||
*
|
||||
* @param selector the iam authority selector
|
||||
* @param token the token
|
||||
* @constructor
|
||||
*/
|
||||
constructor(selector: string, token: string);
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return always false
|
||||
*/
|
||||
createScopedRequired(): boolean;
|
||||
/**
|
||||
* Pass the selector and token to the metadataFn callback.
|
||||
* @deprecated
|
||||
* @param unused_uri is required of the credentials interface
|
||||
* @param metadataFn a callback invoked with object containing request
|
||||
* metadata.
|
||||
*/
|
||||
getRequestMetadata(unusedUri: string | null, metadataFn: (err: Error | null, metadata?: RequestMetadata) => void): void;
|
||||
/**
|
||||
* Acquire the HTTP headers required to make an authenticated request.
|
||||
*/
|
||||
getRequestHeaders(): {
|
||||
'x-goog-iam-authority-selector': string;
|
||||
'x-goog-iam-authorization-token': string;
|
||||
};
|
||||
}
|
66
express-server/node_modules/google-auth-library/build/src/auth/iam.js
generated
vendored
Normal file
66
express-server/node_modules/google-auth-library/build/src/auth/iam.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const messages = require("../messages");
|
||||
class IAMAuth {
|
||||
/**
|
||||
* IAM credentials.
|
||||
*
|
||||
* @param selector the iam authority selector
|
||||
* @param token the token
|
||||
* @constructor
|
||||
*/
|
||||
constructor(selector, token) {
|
||||
this.selector = selector;
|
||||
this.token = token;
|
||||
this.selector = selector;
|
||||
this.token = token;
|
||||
}
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return always false
|
||||
*/
|
||||
createScopedRequired() {
|
||||
// IAM authorization does not use scopes.
|
||||
messages.warn(messages.IAM_CREATE_SCOPED_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Pass the selector and token to the metadataFn callback.
|
||||
* @deprecated
|
||||
* @param unused_uri is required of the credentials interface
|
||||
* @param metadataFn a callback invoked with object containing request
|
||||
* metadata.
|
||||
*/
|
||||
getRequestMetadata(unusedUri, metadataFn) {
|
||||
messages.warn(messages.IAM_GET_REQUEST_METADATA_DEPRECATED);
|
||||
metadataFn(null, this.getRequestHeaders());
|
||||
}
|
||||
/**
|
||||
* Acquire the HTTP headers required to make an authenticated request.
|
||||
*/
|
||||
getRequestHeaders() {
|
||||
return {
|
||||
'x-goog-iam-authority-selector': this.selector,
|
||||
'x-goog-iam-authorization-token': this.token
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.IAMAuth = IAMAuth;
|
||||
//# sourceMappingURL=iam.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/iam.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/iam.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"iam.js","sourceRoot":"","sources":["../../../src/auth/iam.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,wCAAwC;AAOxC,MAAa,OAAO;IAClB;;;;;;OAMG;IACH,YAAmB,QAAgB,EAAS,KAAa;QAAtC,aAAQ,GAAR,QAAQ,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QACvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,oBAAoB;QAClB,yCAAyC;QACzC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,kBAAkB,CACd,SAAsB,EACtB,UAAiE;QACnE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC;QAC5D,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO;YACL,+BAA+B,EAAE,IAAI,CAAC,QAAQ;YAC9C,gCAAgC,EAAE,IAAI,CAAC,KAAK;SAC7C,CAAC;IACJ,CAAC;CACF;AAhDD,0BAgDC"}
|
79
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts
generated
vendored
Normal file
79
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
import { JWTInput } from './credentials';
|
||||
import { Headers, RequestMetadataResponse } from './oauth2client';
|
||||
export declare type Claims = {
|
||||
[index: string]: string;
|
||||
};
|
||||
export declare class JWTAccess {
|
||||
email?: string | null;
|
||||
key?: string | null;
|
||||
keyId?: string | null;
|
||||
projectId?: string;
|
||||
private cache;
|
||||
/**
|
||||
* 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?: string | null, key?: string | null, keyId?: string | null);
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return always false
|
||||
*/
|
||||
createScopedRequired(): boolean;
|
||||
/**
|
||||
* Get a non-expired access token, after refreshing if necessary.
|
||||
*
|
||||
* @param authURI The URI being authorized.
|
||||
* @param additionalClaims An object with a set of additional claims to
|
||||
* include in the payload.
|
||||
* @deprecated Please use `getRequestHeaders` instead.
|
||||
* @returns An object that includes the authorization header.
|
||||
*/
|
||||
getRequestMetadata(url: string, additionalClaims?: Claims): RequestMetadataResponse;
|
||||
/**
|
||||
* 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: string, additionalClaims?: Claims): Headers;
|
||||
/**
|
||||
* Create a JWTAccess credentials instance using the given input options.
|
||||
* @param json The input object.
|
||||
*/
|
||||
fromJSON(json: JWTInput): void;
|
||||
/**
|
||||
* Create a JWTAccess credentials instance using the given input stream.
|
||||
* @param inputStream The input stream.
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
fromStream(inputStream: stream.Readable): Promise<void>;
|
||||
fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
|
||||
private fromStreamAsync;
|
||||
}
|
153
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.js
generated
vendored
Normal file
153
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.js
generated
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const jws = require("jws");
|
||||
const LRU = require("lru-cache");
|
||||
const messages = require("../messages");
|
||||
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) {
|
||||
this.cache = LRU({ max: 500, maxAge: 60 * 60 * 1000 });
|
||||
this.email = email;
|
||||
this.key = key;
|
||||
this.keyId = keyId;
|
||||
}
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createdScoped before use.
|
||||
* @deprecated
|
||||
* @return always false
|
||||
*/
|
||||
createScopedRequired() {
|
||||
// JWT Header authentication does not use scopes.
|
||||
messages.warn(messages.JWT_ACCESS_CREATE_SCOPED_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Get a non-expired access token, after refreshing if necessary.
|
||||
*
|
||||
* @param authURI The URI being authorized.
|
||||
* @param additionalClaims An object with a set of additional claims to
|
||||
* include in the payload.
|
||||
* @deprecated Please use `getRequestHeaders` instead.
|
||||
* @returns An object that includes the authorization header.
|
||||
*/
|
||||
getRequestMetadata(url, additionalClaims) {
|
||||
messages.warn(messages.JWT_ACCESS_GET_REQUEST_METADATA_DEPRECATED);
|
||||
return { headers: this.getRequestHeaders(url, additionalClaims) };
|
||||
}
|
||||
/**
|
||||
* 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) {
|
||||
const cachedToken = this.cache.get(url);
|
||||
if (cachedToken) {
|
||||
return cachedToken;
|
||||
}
|
||||
const iat = Math.floor(new Date().getTime() / 1000);
|
||||
const exp = iat + 3600; // 3600 seconds = 1 hour
|
||||
// The payload used for signed JWT headers has:
|
||||
// iss == sub == <client email>
|
||||
// aud == <the authorization uri>
|
||||
const 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 ? Object.assign({}, 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(url, headers);
|
||||
return headers;
|
||||
}
|
||||
/**
|
||||
* 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(r => 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
|
1
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/jwtaccess.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"jwtaccess.js","sourceRoot":"","sources":["../../../src/auth/jwtaccess.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,2BAA2B;AAC3B,iCAAiC;AAGjC,wCAAwC;AAKxC,MAAM,cAAc,GAAe;IACjC,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,KAAK;CACX,CAAC;AAMF,MAAa,SAAS;IAQpB;;;;;;;;;OASG;IACH,YAAY,KAAmB,EAAE,GAAiB,EAAE,KAAmB;QAZ/D,UAAK,GAAG,GAAG,CAAkB,EAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAC,CAAC,CAAC;QAavE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,oBAAoB;QAClB,iDAAiD;QACjD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,kBAAkB,CAAC,GAAW,EAAE,gBAAyB;QAEvD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,CAAC;QACnE,OAAO,EAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAC,CAAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACH,iBAAiB,CAAC,GAAW,EAAE,gBAAyB;QACtD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,WAAW,EAAE;YACf,OAAO,WAAW,CAAC;SACpB;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,CAAE,wBAAwB;QAEjD,+CAA+C;QAC/C,+BAA+B;QAC/B,iCAAiC;QACjC,MAAM,aAAa,GACf,EAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAC,CAAC;QAE3D,oEAAoE;QACpE,yBAAyB;QACzB,IAAI,gBAAgB,EAAE;YACpB,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE;gBACjC,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,MAAM,IAAI,KAAK,CAAC,QACZ,KAAK,wGAAwG,CAAC,CAAC;iBACpH;aACF;SACF;QAED,MAAM,MAAM,GACR,IAAI,CAAC,KAAK,CAAC,CAAC,mBAAK,cAAc,IAAE,GAAG,EAAE,IAAI,CAAC,KAAK,IAAE,CAAC,CAAC,cAAc,CAAC;QACvE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;QAE/D,uCAAuC;QACvC,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,EAAC,aAAa,EAAE,UAAU,SAAS,EAAE,EAAC,CAAC;QACvD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAc;QACrB,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CACX,0EAA0E,CAAC,CAAC;SACjF;QACD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,MAAM,IAAI,KAAK,CACX,gEAAgE,CAAC,CAAC;SACvE;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,IAAI,KAAK,CACX,+DAA+D,CAAC,CAAC;SACtE;QACD,2DAA2D;QAC3D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,CAAC;IAUD,UAAU,CAAC,WAA4B,EAAE,QAAgC;QAEvE,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;SACnE;aAAM;YACL,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAC1C;IACH,CAAC;IAEO,eAAe,CAAC,WAA4B;QAClD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,CAAC,IAAI,KAAK,CACZ,qEAAqE,CAAC,CAAC,CAAC;aAC7E;YACD,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC;iBAC1B,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC;iBACjC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;iBACnB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACd,IAAI;oBACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBACpB,OAAO,EAAE,CAAC;iBACX;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;YACH,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7JD,8BA6JC"}
|
119
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts
generated
vendored
Normal file
119
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Copyright 2013 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { GoogleToken } from 'gtoken';
|
||||
import * as stream from 'stream';
|
||||
import { CredentialBody, Credentials, JWTInput } from './credentials';
|
||||
import { GetTokenResponse, OAuth2Client, RefreshOptions, RequestMetadataResponse } from './oauth2client';
|
||||
export interface JWTOptions extends RefreshOptions {
|
||||
email?: string;
|
||||
keyFile?: string;
|
||||
key?: string;
|
||||
keyId?: string;
|
||||
scopes?: string | string[];
|
||||
subject?: string;
|
||||
additionalClaims?: {};
|
||||
}
|
||||
export declare class JWT extends OAuth2Client {
|
||||
email?: string;
|
||||
keyFile?: string;
|
||||
key?: string;
|
||||
keyId?: string;
|
||||
scopes?: string | string[];
|
||||
scope?: string;
|
||||
subject?: string;
|
||||
gtoken?: GoogleToken;
|
||||
additionalClaims?: {};
|
||||
private access?;
|
||||
/**
|
||||
* JWT service account credentials.
|
||||
*
|
||||
* Retrieve access token using gtoken.
|
||||
*
|
||||
* @param email service account email address.
|
||||
* @param keyFile path to private key file.
|
||||
* @param key value of key
|
||||
* @param scopes list of requested scopes or a single scope.
|
||||
* @param subject impersonated account's email address.
|
||||
* @param key_id the ID of the key
|
||||
*/
|
||||
constructor(options: JWTOptions);
|
||||
constructor(email?: string, keyFile?: string, key?: string, scopes?: string | string[], subject?: string, keyId?: string);
|
||||
/**
|
||||
* Creates a copy of the credential with the specified scopes.
|
||||
* @param scopes List of requested scopes or a single scope.
|
||||
* @return The cloned instance.
|
||||
*/
|
||||
createScoped(scopes?: string | string[]): JWT;
|
||||
/**
|
||||
* Obtains the metadata to be sent with the request.
|
||||
*
|
||||
* @param url the URI being authorized.
|
||||
*/
|
||||
protected getRequestMetadataAsync(url?: string | null): Promise<RequestMetadataResponse>;
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createScoped before use.
|
||||
* @deprecated
|
||||
* @return false if createScoped does not need to be called.
|
||||
*/
|
||||
createScopedRequired(): boolean;
|
||||
/**
|
||||
* Determine if there are currently scopes available.
|
||||
*/
|
||||
private hasScopes;
|
||||
/**
|
||||
* Get the initial access token using gToken.
|
||||
* @param callback Optional callback.
|
||||
* @returns Promise that resolves with credentials
|
||||
*/
|
||||
authorize(): Promise<Credentials>;
|
||||
authorize(callback: (err: Error | null, result?: Credentials) => void): void;
|
||||
private authorizeAsync;
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken ignored
|
||||
* @private
|
||||
*/
|
||||
protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
|
||||
/**
|
||||
* Create a gToken if it doesn't already exist.
|
||||
*/
|
||||
private createGToken;
|
||||
/**
|
||||
* Create a JWT credentials instance using the given input options.
|
||||
* @param json The input object.
|
||||
*/
|
||||
fromJSON(json: JWTInput): void;
|
||||
/**
|
||||
* Create a JWT credentials instance using the given input stream.
|
||||
* @param inputStream The input stream.
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
fromStream(inputStream: stream.Readable): Promise<void>;
|
||||
fromStream(inputStream: stream.Readable, callback: (err?: Error | null) => void): void;
|
||||
private fromStreamAsync;
|
||||
/**
|
||||
* Creates a JWT credentials instance using an API Key for authentication.
|
||||
* @param apiKey The API Key in string form.
|
||||
*/
|
||||
fromAPIKey(apiKey: string): void;
|
||||
/**
|
||||
* Using the key or keyFile on the JWT client, obtain an object that contains
|
||||
* the key and the client email.
|
||||
*/
|
||||
getCredentials(): Promise<CredentialBody>;
|
||||
}
|
249
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.js
generated
vendored
Normal file
249
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.js
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2013 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const gtoken_1 = require("gtoken");
|
||||
const messages = require("../messages");
|
||||
const jwtaccess_1 = require("./jwtaccess");
|
||||
const oauth2client_1 = require("./oauth2client");
|
||||
const isString = require('lodash.isstring');
|
||||
class JWT extends oauth2client_1.OAuth2Client {
|
||||
constructor(optionsOrEmail, keyFile, key, scopes, subject, keyId) {
|
||||
const opts = (optionsOrEmail && typeof optionsOrEmail === 'object') ?
|
||||
optionsOrEmail :
|
||||
{ email: optionsOrEmail, keyFile, key, keyId, scopes, subject };
|
||||
super({ eagerRefreshThresholdMillis: opts.eagerRefreshThresholdMillis });
|
||||
this.email = opts.email;
|
||||
this.keyFile = opts.keyFile;
|
||||
this.key = opts.key;
|
||||
this.keyId = opts.keyId;
|
||||
this.scopes = opts.scopes;
|
||||
this.subject = opts.subject;
|
||||
this.additionalClaims = opts.additionalClaims;
|
||||
this.credentials = { refresh_token: 'jwt-placeholder', expiry_date: 1 };
|
||||
}
|
||||
/**
|
||||
* Creates a copy of the credential with the specified scopes.
|
||||
* @param scopes List of requested scopes or a single scope.
|
||||
* @return The cloned instance.
|
||||
*/
|
||||
createScoped(scopes) {
|
||||
return new JWT({
|
||||
email: this.email,
|
||||
keyFile: this.keyFile,
|
||||
key: this.key,
|
||||
keyId: this.keyId,
|
||||
scopes,
|
||||
subject: this.subject,
|
||||
additionalClaims: this.additionalClaims
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Obtains the metadata to be sent with the request.
|
||||
*
|
||||
* @param url the URI being authorized.
|
||||
*/
|
||||
getRequestMetadataAsync(url) {
|
||||
const _super = name => super[name];
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!this.apiKey && !this.hasScopes() && url) {
|
||||
if (this.additionalClaims && this.additionalClaims.target_audience) {
|
||||
const { tokens } = yield this.refreshToken();
|
||||
return { headers: { Authorization: `Bearer ${tokens.id_token}` } };
|
||||
}
|
||||
else {
|
||||
// no scopes have been set, but a uri has been provided. Use JWTAccess
|
||||
// credentials.
|
||||
if (!this.access) {
|
||||
this.access = new jwtaccess_1.JWTAccess(this.email, this.key, this.keyId);
|
||||
}
|
||||
const headers = yield this.access.getRequestHeaders(url, this.additionalClaims);
|
||||
return { headers };
|
||||
}
|
||||
}
|
||||
else {
|
||||
return _super("getRequestMetadataAsync").call(this, url);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Indicates whether the credential requires scopes to be created by calling
|
||||
* createScoped before use.
|
||||
* @deprecated
|
||||
* @return false if createScoped does not need to be called.
|
||||
*/
|
||||
createScopedRequired() {
|
||||
messages.warn(messages.JWT_CREATE_SCOPED_DEPRECATED);
|
||||
return !this.hasScopes();
|
||||
}
|
||||
/**
|
||||
* Determine if there are currently scopes available.
|
||||
*/
|
||||
hasScopes() {
|
||||
if (!this.scopes) {
|
||||
return false;
|
||||
}
|
||||
// For arrays, check the array length.
|
||||
if (this.scopes instanceof Array) {
|
||||
return this.scopes.length > 0;
|
||||
}
|
||||
// For others, convert to a string and check the length.
|
||||
return String(this.scopes).length > 0;
|
||||
}
|
||||
authorize(callback) {
|
||||
if (callback) {
|
||||
this.authorizeAsync().then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.authorizeAsync();
|
||||
}
|
||||
}
|
||||
authorizeAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield this.refreshToken();
|
||||
if (!result) {
|
||||
throw new Error('No result returned');
|
||||
}
|
||||
this.credentials = result.tokens;
|
||||
this.credentials.refresh_token = 'jwt-placeholder';
|
||||
this.key = this.gtoken.key;
|
||||
this.email = this.gtoken.iss;
|
||||
return result.tokens;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken ignored
|
||||
* @private
|
||||
*/
|
||||
refreshTokenNoCache(refreshToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const gtoken = this.createGToken();
|
||||
const token = yield gtoken.getToken();
|
||||
const tokens = {
|
||||
access_token: token,
|
||||
token_type: 'Bearer',
|
||||
expiry_date: gtoken.expiresAt,
|
||||
// tslint:disable-next-line no-any
|
||||
id_token: gtoken.rawToken.id_token
|
||||
};
|
||||
this.emit('tokens', tokens);
|
||||
return { res: null, tokens };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create a gToken if it doesn't already exist.
|
||||
*/
|
||||
createGToken() {
|
||||
if (!this.gtoken) {
|
||||
this.gtoken = new gtoken_1.GoogleToken({
|
||||
iss: this.email,
|
||||
sub: this.subject,
|
||||
scope: this.scopes,
|
||||
keyFile: this.keyFile,
|
||||
key: this.key,
|
||||
additionalClaims: this.additionalClaims
|
||||
});
|
||||
}
|
||||
return this.gtoken;
|
||||
}
|
||||
/**
|
||||
* Create a JWT 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(r => callback(), callback);
|
||||
}
|
||||
else {
|
||||
return this.fromStreamAsync(inputStream);
|
||||
}
|
||||
}
|
||||
fromStreamAsync(inputStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!inputStream) {
|
||||
throw new Error('Must pass in a stream containing the service account auth settings.');
|
||||
}
|
||||
let s = '';
|
||||
inputStream.setEncoding('utf8')
|
||||
.on('error', reject)
|
||||
.on('data', (chunk) => s += chunk)
|
||||
.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(s);
|
||||
this.fromJSON(data);
|
||||
resolve();
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Creates a JWT credentials instance using an API Key for authentication.
|
||||
* @param apiKey The API Key in string form.
|
||||
*/
|
||||
fromAPIKey(apiKey) {
|
||||
if (!isString(apiKey)) {
|
||||
throw new Error('Must provide an API Key string.');
|
||||
}
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
/**
|
||||
* Using the key or keyFile on the JWT client, obtain an object that contains
|
||||
* the key and the client email.
|
||||
*/
|
||||
getCredentials() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.key) {
|
||||
return { private_key: this.key, client_email: this.email };
|
||||
}
|
||||
else if (this.keyFile) {
|
||||
const gtoken = this.createGToken();
|
||||
const creds = yield gtoken.getCredentials(this.keyFile);
|
||||
return { private_key: creds.privateKey, client_email: creds.clientEmail };
|
||||
}
|
||||
throw new Error('A key or a keyFile must be provided to getCredentials.');
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.JWT = JWT;
|
||||
//# sourceMappingURL=jwtclient.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/jwtclient.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
150
express-server/node_modules/google-auth-library/build/src/auth/loginticket.d.ts
generated
vendored
Normal file
150
express-server/node_modules/google-auth-library/build/src/auth/loginticket.d.ts
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export declare class LoginTicket {
|
||||
private envelope?;
|
||||
private payload?;
|
||||
/**
|
||||
* Create a simple class to extract user ID from an ID Token
|
||||
*
|
||||
* @param {string} env Envelope of the jwt
|
||||
* @param {TokenPayload} pay Payload of the jwt
|
||||
* @constructor
|
||||
*/
|
||||
constructor(env?: string, pay?: TokenPayload);
|
||||
getEnvelope(): string | undefined;
|
||||
getPayload(): TokenPayload | undefined;
|
||||
/**
|
||||
* Create a simple class to extract user ID from an ID Token
|
||||
*
|
||||
* @return The user ID
|
||||
*/
|
||||
getUserId(): string | null;
|
||||
/**
|
||||
* Returns attributes from the login ticket. This can contain
|
||||
* various information about the user session.
|
||||
*
|
||||
* @return The envelope and payload
|
||||
*/
|
||||
getAttributes(): {
|
||||
envelope: string | undefined;
|
||||
payload: TokenPayload | undefined;
|
||||
};
|
||||
}
|
||||
export interface TokenPayload {
|
||||
/**
|
||||
* The Issuer Identifier for the Issuer of the response. Always
|
||||
* https://accounts.google.com or accounts.google.com for Google ID tokens.
|
||||
*/
|
||||
iss: string;
|
||||
/**
|
||||
* Access token hash. Provides validation that the access token is tied to the
|
||||
* identity token. If the ID token is issued with an access token in the
|
||||
* server flow, this is always included. This can be used as an alternate
|
||||
* mechanism to protect against cross-site request forgery attacks, but if you
|
||||
* follow Step 1 and Step 3 it is not necessary to verify the access token.
|
||||
*/
|
||||
at_hash?: string;
|
||||
/**
|
||||
* True if the user's e-mail address has been verified; otherwise false.
|
||||
*/
|
||||
email_verified?: boolean;
|
||||
/**
|
||||
* An identifier for the user, unique among all Google accounts and never
|
||||
* reused. A Google account can have multiple emails at different points in
|
||||
* time, but the sub value is never changed. Use sub within your application
|
||||
* as the unique-identifier key for the user.
|
||||
*/
|
||||
sub: string;
|
||||
/**
|
||||
* The client_id of the authorized presenter. This claim is only needed when
|
||||
* the party requesting the ID token is not the same as the audience of the ID
|
||||
* token. This may be the case at Google for hybrid apps where a web
|
||||
* application and Android app have a different client_id but share the same
|
||||
* project.
|
||||
*/
|
||||
azp?: string;
|
||||
/**
|
||||
* The user's email address. This may not be unique and is not suitable for
|
||||
* use as a primary key. Provided only if your scope included the string
|
||||
* "email".
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
* The URL of the user's profile page. Might be provided when:
|
||||
* - The request scope included the string "profile"
|
||||
* - The ID token is returned from a token refresh
|
||||
* - When profile claims are present, you can use them to update your app's
|
||||
* user records. Note that this claim is never guaranteed to be present.
|
||||
*/
|
||||
profile?: string;
|
||||
/**
|
||||
* The URL of the user's profile picture. Might be provided when:
|
||||
* - The request scope included the string "profile"
|
||||
* - The ID token is returned from a token refresh
|
||||
* - When picture claims are present, you can use them to update your app's
|
||||
* user records. Note that this claim is never guaranteed to be present.
|
||||
*/
|
||||
picture?: string;
|
||||
/**
|
||||
* The user's full name, in a displayable form. Might be provided when:
|
||||
* - The request scope included the string "profile"
|
||||
* - The ID token is returned from a token refresh
|
||||
* - When name claims are present, you can use them to update your app's user
|
||||
* records. Note that this claim is never guaranteed to be present.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The user's given name, in a displayable form. Might be provided when:
|
||||
* - The request scope included the string "profile"
|
||||
* - The ID token is returned from a token refresh
|
||||
* - When name claims are present, you can use them to update your app's user
|
||||
* records. Note that this claim is never guaranteed to be present.
|
||||
*/
|
||||
given_name?: string;
|
||||
/**
|
||||
* The user's family name, in a displayable form. Might be provided when:
|
||||
* - The request scope included the string "profile"
|
||||
* - The ID token is returned from a token refresh
|
||||
* - When name claims are present, you can use them to update your app's user
|
||||
* records. Note that this claim is never guaranteed to be present.
|
||||
*/
|
||||
family_name?: string;
|
||||
/**
|
||||
* Identifies the audience that this ID token is intended for. It must be one
|
||||
* of the OAuth 2.0 client IDs of your application.
|
||||
*/
|
||||
aud: string;
|
||||
/**
|
||||
* The time the ID token was issued, represented in Unix time (integer
|
||||
* seconds).
|
||||
*/
|
||||
iat: number;
|
||||
/**
|
||||
* The time the ID token expires, represented in Unix time (integer seconds).
|
||||
*/
|
||||
exp: number;
|
||||
/**
|
||||
* The value of the nonce supplied by your app in the authentication request.
|
||||
* You should enforce protection against replay attacks by ensuring it is
|
||||
* presented only once.
|
||||
*/
|
||||
nonce?: string;
|
||||
/**
|
||||
* The hosted G Suite domain of the user. Provided only if the user belongs to
|
||||
* a hosted domain.
|
||||
*/
|
||||
hd?: string;
|
||||
}
|
59
express-server/node_modules/google-auth-library/build/src/auth/loginticket.js
generated
vendored
Normal file
59
express-server/node_modules/google-auth-library/build/src/auth/loginticket.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
class LoginTicket {
|
||||
/**
|
||||
* Create a simple class to extract user ID from an ID Token
|
||||
*
|
||||
* @param {string} env Envelope of the jwt
|
||||
* @param {TokenPayload} pay Payload of the jwt
|
||||
* @constructor
|
||||
*/
|
||||
constructor(env, pay) {
|
||||
this.envelope = env;
|
||||
this.payload = pay;
|
||||
}
|
||||
getEnvelope() {
|
||||
return this.envelope;
|
||||
}
|
||||
getPayload() {
|
||||
return this.payload;
|
||||
}
|
||||
/**
|
||||
* Create a simple class to extract user ID from an ID Token
|
||||
*
|
||||
* @return The user ID
|
||||
*/
|
||||
getUserId() {
|
||||
const payload = this.getPayload();
|
||||
if (payload && payload.sub) {
|
||||
return payload.sub;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns attributes from the login ticket. This can contain
|
||||
* various information about the user session.
|
||||
*
|
||||
* @return The envelope and payload
|
||||
*/
|
||||
getAttributes() {
|
||||
return { envelope: this.getEnvelope(), payload: this.getPayload() };
|
||||
}
|
||||
}
|
||||
exports.LoginTicket = LoginTicket;
|
||||
//# sourceMappingURL=loginticket.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/loginticket.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/loginticket.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"loginticket.js","sourceRoot":"","sources":["../../../src/auth/loginticket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,MAAa,WAAW;IAItB;;;;;;OAMG;IACH,YAAY,GAAY,EAAE,GAAkB;QAC1C,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;YAC1B,OAAO,OAAO,CAAC,GAAG,CAAC;SACpB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa;QACX,OAAO,EAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAC,CAAC;IACpE,CAAC;CACF;AA9CD,kCA8CC"}
|
459
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts
generated
vendored
Normal file
459
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts
generated
vendored
Normal file
@ -0,0 +1,459 @@
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import { AxiosError, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { BodyResponseCallback } from './../transporters';
|
||||
import { AuthClient } from './authclient';
|
||||
import { Credentials } from './credentials';
|
||||
import { LoginTicket } from './loginticket';
|
||||
export declare type Certificates = {
|
||||
[index: string]: string;
|
||||
};
|
||||
export declare type Headers = {
|
||||
[index: string]: string;
|
||||
};
|
||||
export declare enum CodeChallengeMethod {
|
||||
Plain = "plain",
|
||||
S256 = "S256"
|
||||
}
|
||||
export interface GetTokenOptions {
|
||||
code: string;
|
||||
codeVerifier?: string;
|
||||
/**
|
||||
* The client ID for your application. The value passed into the constructor
|
||||
* will be used if not provided. Must match any client_id option passed to
|
||||
* a corresponding call to generateAuthUrl.
|
||||
*/
|
||||
client_id?: string;
|
||||
/**
|
||||
* Determines where the API server redirects the user after the user
|
||||
* completes the authorization flow. The value passed into the constructor
|
||||
* will be used if not provided. Must match any redirect_uri option passed to
|
||||
* a corresponding call to generateAuthUrl.
|
||||
*/
|
||||
redirect_uri?: string;
|
||||
}
|
||||
export interface TokenInfo {
|
||||
/**
|
||||
* The application that is the intended user of the access token.
|
||||
*/
|
||||
aud: string;
|
||||
/**
|
||||
* This value lets you correlate profile information from multiple Google
|
||||
* APIs. It is only present in the response if you included the profile scope
|
||||
* in your request in step 1. The field value is an immutable identifier for
|
||||
* the logged-in user that can be used to create and manage user sessions in
|
||||
* your application. The identifier is the same regardless of which client ID
|
||||
* is used to retrieve it. This enables multiple applications in the same
|
||||
* organization to correlate profile information.
|
||||
*/
|
||||
user_id?: string;
|
||||
/**
|
||||
* An array of scopes that the user granted access to.
|
||||
*/
|
||||
scopes: string[];
|
||||
/**
|
||||
* The datetime when the token becomes invalid.
|
||||
*/
|
||||
expiry_date: number;
|
||||
/**
|
||||
* An identifier for the user, unique among all Google accounts and never
|
||||
* reused. A Google account can have multiple emails at different points in
|
||||
* time, but the sub value is never changed. Use sub within your application
|
||||
* as the unique-identifier key for the user.
|
||||
*/
|
||||
sub?: string;
|
||||
/**
|
||||
* The client_id of the authorized presenter. This claim is only needed when
|
||||
* the party requesting the ID token is not the same as the audience of the ID
|
||||
* token. This may be the case at Google for hybrid apps where a web
|
||||
* application and Android app have a different client_id but share the same
|
||||
* project.
|
||||
*/
|
||||
azp?: string;
|
||||
/**
|
||||
* Indicates whether your application can refresh access tokens
|
||||
* when the user is not present at the browser. Valid parameter values are
|
||||
* 'online', which is the default value, and 'offline'. Set the value to
|
||||
* 'offline' if your application needs to refresh access tokens when the user
|
||||
* is not present at the browser. This value instructs the Google
|
||||
* authorization server to return a refresh token and an access token the
|
||||
* first time that your application exchanges an authorization code for
|
||||
* tokens.
|
||||
*/
|
||||
access_type?: string;
|
||||
}
|
||||
export interface TokenInfoRequest {
|
||||
aud: string;
|
||||
user_id?: string;
|
||||
scope: string;
|
||||
expires_in: number;
|
||||
azp?: string;
|
||||
sub?: string;
|
||||
exp?: number;
|
||||
access_type?: string;
|
||||
}
|
||||
export interface GenerateAuthUrlOpts {
|
||||
/**
|
||||
* Recommended. Indicates whether your application can refresh access tokens
|
||||
* when the user is not present at the browser. Valid parameter values are
|
||||
* 'online', which is the default value, and 'offline'. Set the value to
|
||||
* 'offline' if your application needs to refresh access tokens when the user
|
||||
* is not present at the browser. This value instructs the Google
|
||||
* authorization server to return a refresh token and an access token the
|
||||
* first time that your application exchanges an authorization code for
|
||||
* tokens.
|
||||
*/
|
||||
access_type?: string;
|
||||
/**
|
||||
* The 'response_type' will always be set to 'CODE'.
|
||||
*/
|
||||
response_type?: string;
|
||||
/**
|
||||
* The client ID for your application. The value passed into the constructor
|
||||
* will be used if not provided. You can find this value in the API Console.
|
||||
*/
|
||||
client_id?: string;
|
||||
/**
|
||||
* Determines where the API server redirects the user after the user
|
||||
* completes the authorization flow. The value must exactly match one of the
|
||||
* 'redirect_uri' values listed for your project in the API Console. Note that
|
||||
* the http or https scheme, case, and trailing slash ('/') must all match.
|
||||
* The value passed into the constructor will be used if not provided.
|
||||
*/
|
||||
redirect_uri?: string;
|
||||
/**
|
||||
* Required. A space-delimited list of scopes that identify the resources that
|
||||
* your application could access on the user's behalf. These values inform the
|
||||
* consent screen that Google displays to the user. Scopes enable your
|
||||
* application to only request access to the resources that it needs while
|
||||
* also enabling users to control the amount of access that they grant to your
|
||||
* application. Thus, there is an inverse relationship between the number of
|
||||
* scopes requested and the likelihood of obtaining user consent. The
|
||||
* OAuth 2.0 API Scopes document provides a full list of scopes that you might
|
||||
* use to access Google APIs. We recommend that your application request
|
||||
* access to authorization scopes in context whenever possible. By requesting
|
||||
* access to user data in context, via incremental authorization, you help
|
||||
* users to more easily understand why your application needs the access it is
|
||||
* requesting.
|
||||
*/
|
||||
scope?: string[] | string;
|
||||
/**
|
||||
* Recommended. Specifies any string value that your application uses to
|
||||
* maintain state between your authorization request and the authorization
|
||||
* server's response. The server returns the exact value that you send as a
|
||||
* name=value pair in the hash (#) fragment of the 'redirect_uri' after the
|
||||
* user consents to or denies your application's access request. You can use
|
||||
* this parameter for several purposes, such as directing the user to the
|
||||
* correct resource in your application, sending nonces, and mitigating
|
||||
* cross-site request forgery. Since your redirect_uri can be guessed, using a
|
||||
* state value can increase your assurance that an incoming connection is the
|
||||
* result of an authentication request. If you generate a random string or
|
||||
* encode the hash of a cookie or another value that captures the client's
|
||||
* state, you can validate the response to additionally ensure that the
|
||||
* request and response originated in the same browser, providing protection
|
||||
* against attacks such as cross-site request forgery. See the OpenID Connect
|
||||
* documentation for an example of how to create and confirm a state token.
|
||||
*/
|
||||
state?: string;
|
||||
/**
|
||||
* Optional. Enables applications to use incremental authorization to request
|
||||
* access to additional scopes in context. If you set this parameter's value
|
||||
* to true and the authorization request is granted, then the new access token
|
||||
* will also cover any scopes to which the user previously granted the
|
||||
* application access. See the incremental authorization section for examples.
|
||||
*/
|
||||
include_granted_scopes?: boolean;
|
||||
/**
|
||||
* Optional. If your application knows which user is trying to authenticate,
|
||||
* it can use this parameter to provide a hint to the Google Authentication
|
||||
* Server. The server uses the hint to simplify the login flow either by
|
||||
* prefilling the email field in the sign-in form or by selecting the
|
||||
* appropriate multi-login session. Set the parameter value to an email
|
||||
* address or sub identifier, which is equivalent to the user's Google ID.
|
||||
*/
|
||||
login_hint?: string;
|
||||
/**
|
||||
* Optional. A space-delimited, case-sensitive list of prompts to present the
|
||||
* user. If you don't specify this parameter, the user will be prompted only
|
||||
* the first time your app requests access. Possible values are:
|
||||
*
|
||||
* 'none' - Donot display any authentication or consent screens. Must not be
|
||||
* specified with other values.
|
||||
* 'consent' - Prompt the user for consent.
|
||||
* 'select_account' - Prompt the user to select an account.
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* Recommended. Specifies what method was used to encode a 'code_verifier'
|
||||
* that will be used during authorization code exchange. This parameter must
|
||||
* be used with the 'code_challenge' parameter. The value of the
|
||||
* 'code_challenge_method' defaults to "plain" if not present in the request
|
||||
* that includes a 'code_challenge'. The only supported values for this
|
||||
* parameter are "S256" or "plain".
|
||||
*/
|
||||
code_challenge_method?: CodeChallengeMethod;
|
||||
/**
|
||||
* Recommended. Specifies an encoded 'code_verifier' that will be used as a
|
||||
* server-side challenge during authorization code exchange. This parameter
|
||||
* must be used with the 'code_challenge' parameter described above.
|
||||
*/
|
||||
code_challenge?: string;
|
||||
}
|
||||
export interface GetTokenCallback {
|
||||
(err: AxiosError | null, token?: Credentials | null, res?: AxiosResponse | null): void;
|
||||
}
|
||||
export interface GetTokenResponse {
|
||||
tokens: Credentials;
|
||||
res: AxiosResponse | null;
|
||||
}
|
||||
export interface GetAccessTokenCallback {
|
||||
(err: AxiosError | null, token?: string | null, res?: AxiosResponse | null): void;
|
||||
}
|
||||
export interface GetAccessTokenResponse {
|
||||
token?: string | null;
|
||||
res?: AxiosResponse | null;
|
||||
}
|
||||
export interface RefreshAccessTokenCallback {
|
||||
(err: AxiosError | null, credentials?: Credentials | null, res?: AxiosResponse | null): void;
|
||||
}
|
||||
export interface RefreshAccessTokenResponse {
|
||||
credentials: Credentials;
|
||||
res: AxiosResponse | null;
|
||||
}
|
||||
export interface RequestMetadataResponse {
|
||||
headers: Headers;
|
||||
res?: AxiosResponse<void> | null;
|
||||
}
|
||||
export interface RequestMetadataCallback {
|
||||
(err: AxiosError | null, headers?: Headers, res?: AxiosResponse<void> | null): void;
|
||||
}
|
||||
export interface GetFederatedSignonCertsCallback {
|
||||
(err: AxiosError | null, certs?: Certificates, response?: AxiosResponse<void> | null): void;
|
||||
}
|
||||
export interface FederatedSignonCertsResponse {
|
||||
certs: Certificates;
|
||||
res?: AxiosResponse<void> | null;
|
||||
}
|
||||
export interface RevokeCredentialsResult {
|
||||
success: boolean;
|
||||
}
|
||||
export interface VerifyIdTokenOptions {
|
||||
idToken: string;
|
||||
audience: string | string[];
|
||||
maxExpiry?: number;
|
||||
}
|
||||
export interface OAuth2ClientOptions extends RefreshOptions {
|
||||
clientId?: string;
|
||||
clientSecret?: string;
|
||||
redirectUri?: string;
|
||||
}
|
||||
export interface RefreshOptions {
|
||||
eagerRefreshThresholdMillis?: number;
|
||||
}
|
||||
export declare class OAuth2Client extends AuthClient {
|
||||
private redirectUri?;
|
||||
private certificateCache?;
|
||||
private certificateExpiry;
|
||||
protected refreshTokenPromises: Map<string, Promise<GetTokenResponse>>;
|
||||
_clientId?: string;
|
||||
_clientSecret?: string;
|
||||
apiKey?: string;
|
||||
projectId?: string;
|
||||
eagerRefreshThresholdMillis: number;
|
||||
/**
|
||||
* Handles OAuth2 flow for Google APIs.
|
||||
*
|
||||
* @param clientId The authentication client ID.
|
||||
* @param clientSecret The authentication client secret.
|
||||
* @param redirectUri The URI to redirect to after completing the auth
|
||||
* request.
|
||||
* @param opts optional options for overriding the given parameters.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(options?: OAuth2ClientOptions);
|
||||
constructor(clientId?: string, clientSecret?: string, redirectUri?: string);
|
||||
protected static readonly GOOGLE_TOKEN_INFO_URL: string;
|
||||
/**
|
||||
* The base URL for auth endpoints.
|
||||
*/
|
||||
private static readonly GOOGLE_OAUTH2_AUTH_BASE_URL_;
|
||||
/**
|
||||
* The base endpoint for token retrieval.
|
||||
*/
|
||||
private static readonly GOOGLE_OAUTH2_TOKEN_URL_;
|
||||
/**
|
||||
* The base endpoint to revoke tokens.
|
||||
*/
|
||||
private static readonly GOOGLE_OAUTH2_REVOKE_URL_;
|
||||
/**
|
||||
* Google Sign on certificates.
|
||||
*/
|
||||
private static readonly GOOGLE_OAUTH2_FEDERATED_SIGNON_CERTS_URL_;
|
||||
/**
|
||||
* Clock skew - five minutes in seconds
|
||||
*/
|
||||
private static readonly CLOCK_SKEW_SECS_;
|
||||
/**
|
||||
* Max Token Lifetime is one day in seconds
|
||||
*/
|
||||
private static readonly MAX_TOKEN_LIFETIME_SECS_;
|
||||
/**
|
||||
* The allowed oauth token issuers.
|
||||
*/
|
||||
private static readonly ISSUERS_;
|
||||
/**
|
||||
* Generates URL for consent page landing.
|
||||
* @param opts Options.
|
||||
* @return URL to consent page.
|
||||
*/
|
||||
generateAuthUrl(opts?: GenerateAuthUrlOpts): string;
|
||||
/**
|
||||
* Convenience method to automatically generate a code_verifier, and it's
|
||||
* resulting SHA256. If used, this must be paired with a S256
|
||||
* code_challenge_method.
|
||||
*/
|
||||
generateCodeVerifier(): {
|
||||
codeVerifier: string;
|
||||
codeChallenge: string;
|
||||
};
|
||||
/**
|
||||
* Gets the access token for the given code.
|
||||
* @param code The authorization code.
|
||||
* @param callback Optional callback fn.
|
||||
*/
|
||||
getToken(code: string): Promise<GetTokenResponse>;
|
||||
getToken(options: GetTokenOptions): Promise<GetTokenResponse>;
|
||||
getToken(code: string, callback: GetTokenCallback): void;
|
||||
getToken(options: GetTokenOptions, callback: GetTokenCallback): void;
|
||||
private getTokenAsync;
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refresh_token Existing refresh token.
|
||||
* @private
|
||||
*/
|
||||
protected refreshToken(refreshToken?: string | null): Promise<GetTokenResponse>;
|
||||
protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
|
||||
/**
|
||||
* Retrieves the access token using refresh token
|
||||
*
|
||||
* @deprecated use getRequestHeaders instead.
|
||||
* @param callback callback
|
||||
*/
|
||||
refreshAccessToken(): Promise<RefreshAccessTokenResponse>;
|
||||
refreshAccessToken(callback: RefreshAccessTokenCallback): void;
|
||||
private refreshAccessTokenAsync;
|
||||
/**
|
||||
* Get a non-expired access token, after refreshing if necessary
|
||||
*
|
||||
* @param callback Callback to call with the access token
|
||||
*/
|
||||
getAccessToken(): Promise<GetAccessTokenResponse>;
|
||||
getAccessToken(callback: GetAccessTokenCallback): void;
|
||||
private getAccessTokenAsync;
|
||||
/**
|
||||
* Obtain the set of headers required to authenticate a request.
|
||||
*
|
||||
* @deprecated Use getRequestHeaders instead.
|
||||
* @param url the Uri being authorized
|
||||
* @param callback the func described above
|
||||
*/
|
||||
getRequestMetadata(url?: string | null): Promise<RequestMetadataResponse>;
|
||||
getRequestMetadata(url: string | null, callback: RequestMetadataCallback): void;
|
||||
/**
|
||||
* The main authentication interface. It takes an optional url which when
|
||||
* present is the endpoint being accessed, and returns a Promise which
|
||||
* resolves with authorization header fields.
|
||||
*
|
||||
* In OAuth2Client, the result has the form:
|
||||
* { Authorization: 'Bearer <access_token_value>' }
|
||||
* @param url The optional url being authorized
|
||||
*/
|
||||
getRequestHeaders(url?: string): Promise<Headers>;
|
||||
protected getRequestMetadataAsync(url?: string | null): Promise<RequestMetadataResponse>;
|
||||
/**
|
||||
* Revokes the access given to token.
|
||||
* @param token The existing token to be revoked.
|
||||
* @param callback Optional callback fn.
|
||||
*/
|
||||
revokeToken(token: string): AxiosPromise<RevokeCredentialsResult>;
|
||||
revokeToken(token: string, callback: BodyResponseCallback<RevokeCredentialsResult>): void;
|
||||
/**
|
||||
* Revokes access token and clears the credentials object
|
||||
* @param callback callback
|
||||
*/
|
||||
revokeCredentials(): AxiosPromise<RevokeCredentialsResult>;
|
||||
revokeCredentials(callback: BodyResponseCallback<RevokeCredentialsResult>): void;
|
||||
private revokeCredentialsAsync;
|
||||
/**
|
||||
* Provides a request implementation with OAuth 2.0 flow. If credentials have
|
||||
* a refresh_token, in cases of HTTP 401 and 403 responses, it automatically
|
||||
* asks for a new access token and replays the unsuccessful request.
|
||||
* @param opts Request options.
|
||||
* @param callback callback.
|
||||
* @return Request object
|
||||
*/
|
||||
request<T>(opts: AxiosRequestConfig): AxiosPromise<T>;
|
||||
request<T>(opts: AxiosRequestConfig, callback: BodyResponseCallback<T>): void;
|
||||
protected requestAsync<T>(opts: AxiosRequestConfig, retry?: boolean): Promise<AxiosResponse<T>>;
|
||||
/**
|
||||
* Verify id token is token by checking the certs and audience
|
||||
* @param options that contains all options.
|
||||
* @param callback Callback supplying GoogleLogin if successful
|
||||
*/
|
||||
verifyIdToken(options: VerifyIdTokenOptions): Promise<LoginTicket | null>;
|
||||
verifyIdToken(options: VerifyIdTokenOptions, callback: (err: Error | null, login?: LoginTicket | null) => void): void;
|
||||
private verifyIdTokenAsync;
|
||||
/**
|
||||
* Obtains information about the provisioned access token. Especially useful
|
||||
* if you want to check the scopes that were provisioned to a given token.
|
||||
*
|
||||
* @param accessToken Required. The Access Token for which you want to get
|
||||
* user info.
|
||||
*/
|
||||
getTokenInfo(accessToken: string): Promise<TokenInfo>;
|
||||
/**
|
||||
* Gets federated sign-on certificates to use for verifying identity tokens.
|
||||
* Returns certs as array structure, where keys are key ids, and values
|
||||
* are PEM encoded certificates.
|
||||
* @param callback Callback supplying the certificates
|
||||
*/
|
||||
getFederatedSignonCerts(): Promise<FederatedSignonCertsResponse>;
|
||||
getFederatedSignonCerts(callback: GetFederatedSignonCertsCallback): void;
|
||||
getFederatedSignonCertsAsync(): Promise<FederatedSignonCertsResponse>;
|
||||
/**
|
||||
* Verify the id token is signed with the correct certificate
|
||||
* and is from the correct audience.
|
||||
* @param jwt The jwt to verify (The ID Token in this case).
|
||||
* @param certs The array of certs to test the jwt against.
|
||||
* @param requiredAudience The audience to test the jwt against.
|
||||
* @param issuers The allowed issuers of the jwt (Optional).
|
||||
* @param maxExpiry The max expiry the certificate can be (Optional).
|
||||
* @return Returns a LoginTicket on verification.
|
||||
*/
|
||||
verifySignedJwtWithCerts(jwt: string, certs: Certificates, requiredAudience: string | string[], issuers?: string[], maxExpiry?: number): LoginTicket;
|
||||
/**
|
||||
* This is a utils method to decode a base64 string
|
||||
* @param b64String The string to base64 decode
|
||||
* @return The decoded string
|
||||
*/
|
||||
decodeBase64(b64String: string): string;
|
||||
/**
|
||||
* Returns true if a token is expired or will expire within
|
||||
* eagerRefreshThresholdMillismilliseconds.
|
||||
* If there is no expiry time, assumes the token is not expired or expiring.
|
||||
*/
|
||||
protected isTokenExpiring(): boolean;
|
||||
}
|
613
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.js
generated
vendored
Normal file
613
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.js
generated
vendored
Normal file
@ -0,0 +1,613 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const crypto = require("crypto");
|
||||
const querystring = require("querystring");
|
||||
const stream = require("stream");
|
||||
const messages = require("../messages");
|
||||
const pemverifier_1 = require("./../pemverifier");
|
||||
const authclient_1 = require("./authclient");
|
||||
const loginticket_1 = require("./loginticket");
|
||||
var CodeChallengeMethod;
|
||||
(function (CodeChallengeMethod) {
|
||||
CodeChallengeMethod["Plain"] = "plain";
|
||||
CodeChallengeMethod["S256"] = "S256";
|
||||
})(CodeChallengeMethod = exports.CodeChallengeMethod || (exports.CodeChallengeMethod = {}));
|
||||
class OAuth2Client extends authclient_1.AuthClient {
|
||||
constructor(optionsOrClientId, clientSecret, redirectUri) {
|
||||
super();
|
||||
this.certificateExpiry = null;
|
||||
this.refreshTokenPromises = new Map();
|
||||
const opts = (optionsOrClientId && typeof optionsOrClientId === 'object') ?
|
||||
optionsOrClientId :
|
||||
{ clientId: optionsOrClientId, clientSecret, redirectUri };
|
||||
this._clientId = opts.clientId;
|
||||
this._clientSecret = opts.clientSecret;
|
||||
this.redirectUri = opts.redirectUri;
|
||||
this.eagerRefreshThresholdMillis =
|
||||
opts.eagerRefreshThresholdMillis || 5 * 60 * 1000;
|
||||
}
|
||||
/**
|
||||
* Generates URL for consent page landing.
|
||||
* @param opts Options.
|
||||
* @return URL to consent page.
|
||||
*/
|
||||
generateAuthUrl(opts = {}) {
|
||||
if (opts.code_challenge_method && !opts.code_challenge) {
|
||||
throw new Error('If a code_challenge_method is provided, code_challenge must be included.');
|
||||
}
|
||||
opts.response_type = opts.response_type || 'code';
|
||||
opts.client_id = opts.client_id || this._clientId;
|
||||
opts.redirect_uri = opts.redirect_uri || this.redirectUri;
|
||||
// Allow scopes to be passed either as array or a string
|
||||
if (opts.scope instanceof Array) {
|
||||
opts.scope = opts.scope.join(' ');
|
||||
}
|
||||
const rootUrl = OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_;
|
||||
return rootUrl + '?' + querystring.stringify(opts);
|
||||
}
|
||||
/**
|
||||
* Convenience method to automatically generate a code_verifier, and it's
|
||||
* resulting SHA256. If used, this must be paired with a S256
|
||||
* code_challenge_method.
|
||||
*/
|
||||
generateCodeVerifier() {
|
||||
// base64 encoding uses 6 bits per character, and we want to generate128
|
||||
// characters. 6*128/8 = 96.
|
||||
const randomString = crypto.randomBytes(96).toString('base64');
|
||||
// The valid characters in the code_verifier are [A-Z]/[a-z]/[0-9]/
|
||||
// "-"/"."/"_"/"~". Base64 encoded strings are pretty close, so we're just
|
||||
// swapping out a few chars.
|
||||
const codeVerifier = randomString.replace(/\+/g, '~').replace(/=/g, '_').replace(/\//g, '-');
|
||||
// Generate the base64 encoded SHA256
|
||||
const unencodedCodeChallenge = crypto.createHash('sha256').update(codeVerifier).digest('base64');
|
||||
// We need to use base64UrlEncoding instead of standard base64
|
||||
const codeChallenge = unencodedCodeChallenge.split('=')[0]
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_');
|
||||
return { codeVerifier, codeChallenge };
|
||||
}
|
||||
getToken(codeOrOptions, callback) {
|
||||
const options = (typeof codeOrOptions === 'string') ?
|
||||
{ code: codeOrOptions } :
|
||||
codeOrOptions;
|
||||
if (callback) {
|
||||
this.getTokenAsync(options).then(r => callback(null, r.tokens, r.res), e => callback(e, null, e.response));
|
||||
}
|
||||
else {
|
||||
return this.getTokenAsync(options);
|
||||
}
|
||||
}
|
||||
getTokenAsync(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_;
|
||||
const values = {
|
||||
code: options.code,
|
||||
client_id: options.client_id || this._clientId,
|
||||
client_secret: this._clientSecret,
|
||||
redirect_uri: options.redirect_uri || this.redirectUri,
|
||||
grant_type: 'authorization_code',
|
||||
code_verifier: options.codeVerifier
|
||||
};
|
||||
const res = yield this.transporter.request({
|
||||
method: 'POST',
|
||||
url,
|
||||
data: querystring.stringify(values),
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
});
|
||||
const tokens = res.data;
|
||||
if (res.data && res.data.expires_in) {
|
||||
tokens.expiry_date =
|
||||
((new Date()).getTime() + (res.data.expires_in * 1000));
|
||||
delete tokens.expires_in;
|
||||
}
|
||||
this.emit('tokens', tokens);
|
||||
return { tokens, res };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refresh_token Existing refresh token.
|
||||
* @private
|
||||
*/
|
||||
refreshToken(refreshToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!refreshToken) {
|
||||
return this.refreshTokenNoCache(refreshToken);
|
||||
}
|
||||
// If a request to refresh using the same token has started,
|
||||
// return the same promise.
|
||||
if (this.refreshTokenPromises.has(refreshToken)) {
|
||||
return this.refreshTokenPromises.get(refreshToken);
|
||||
}
|
||||
const p = this.refreshTokenNoCache(refreshToken)
|
||||
.then(r => {
|
||||
this.refreshTokenPromises.delete(refreshToken);
|
||||
return r;
|
||||
}, e => {
|
||||
this.refreshTokenPromises.delete(refreshToken);
|
||||
throw e;
|
||||
});
|
||||
this.refreshTokenPromises.set(refreshToken, p);
|
||||
return p;
|
||||
});
|
||||
}
|
||||
refreshTokenNoCache(refreshToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_;
|
||||
const data = {
|
||||
refresh_token: refreshToken,
|
||||
client_id: this._clientId,
|
||||
client_secret: this._clientSecret,
|
||||
grant_type: 'refresh_token'
|
||||
};
|
||||
// request for new token
|
||||
const res = yield this.transporter.request({
|
||||
method: 'POST',
|
||||
url,
|
||||
data: querystring.stringify(data),
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
});
|
||||
const tokens = res.data;
|
||||
// TODO: de-duplicate this code from a few spots
|
||||
if (res.data && res.data.expires_in) {
|
||||
tokens.expiry_date =
|
||||
((new Date()).getTime() + (res.data.expires_in * 1000));
|
||||
delete tokens.expires_in;
|
||||
}
|
||||
this.emit('tokens', tokens);
|
||||
return { tokens, res };
|
||||
});
|
||||
}
|
||||
refreshAccessToken(callback) {
|
||||
messages.warn(messages.REFRESH_ACCESS_TOKEN_DEPRECATED);
|
||||
if (callback) {
|
||||
this.refreshAccessTokenAsync().then(r => callback(null, r.credentials, r.res), callback);
|
||||
}
|
||||
else {
|
||||
return this.refreshAccessTokenAsync();
|
||||
}
|
||||
}
|
||||
refreshAccessTokenAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!this.credentials.refresh_token) {
|
||||
throw new Error('No refresh token is set.');
|
||||
}
|
||||
const r = yield this.refreshToken(this.credentials.refresh_token);
|
||||
const tokens = r.tokens;
|
||||
tokens.refresh_token = this.credentials.refresh_token;
|
||||
this.credentials = tokens;
|
||||
return { credentials: this.credentials, res: r.res };
|
||||
});
|
||||
}
|
||||
getAccessToken(callback) {
|
||||
if (callback) {
|
||||
this.getAccessTokenAsync().then(r => callback(null, r.token, r.res), callback);
|
||||
}
|
||||
else {
|
||||
return this.getAccessTokenAsync();
|
||||
}
|
||||
}
|
||||
getAccessTokenAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const shouldRefresh = !this.credentials.access_token || this.isTokenExpiring();
|
||||
if (shouldRefresh && this.credentials.refresh_token) {
|
||||
if (!this.credentials.refresh_token) {
|
||||
throw new Error('No refresh token is set.');
|
||||
}
|
||||
const r = yield this.refreshAccessTokenAsync();
|
||||
if (!r.credentials || (r.credentials && !r.credentials.access_token)) {
|
||||
throw new Error('Could not refresh access token.');
|
||||
}
|
||||
return { token: r.credentials.access_token, res: r.res };
|
||||
}
|
||||
else {
|
||||
return { token: this.credentials.access_token };
|
||||
}
|
||||
});
|
||||
}
|
||||
getRequestMetadata(url, callback) {
|
||||
messages.warn(messages.OAUTH_GET_REQUEST_METADATA_DEPRECATED);
|
||||
if (callback) {
|
||||
this.getRequestMetadataAsync(url).then(r => callback(null, r.headers, r.res), callback);
|
||||
}
|
||||
else {
|
||||
return this.getRequestMetadataAsync();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The main authentication interface. It takes an optional url which when
|
||||
* present is the endpoint being accessed, and returns a Promise which
|
||||
* resolves with authorization header fields.
|
||||
*
|
||||
* In OAuth2Client, the result has the form:
|
||||
* { Authorization: 'Bearer <access_token_value>' }
|
||||
* @param url The optional url being authorized
|
||||
*/
|
||||
getRequestHeaders(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const res = yield this.getRequestMetadataAsync(url);
|
||||
return res.headers;
|
||||
});
|
||||
}
|
||||
getRequestMetadataAsync(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const thisCreds = this.credentials;
|
||||
if (!thisCreds.access_token && !thisCreds.refresh_token && !this.apiKey) {
|
||||
throw new Error('No access, refresh token or API key is set.');
|
||||
}
|
||||
if (thisCreds.access_token && !this.isTokenExpiring()) {
|
||||
thisCreds.token_type = thisCreds.token_type || 'Bearer';
|
||||
const headers = {
|
||||
Authorization: thisCreds.token_type + ' ' + thisCreds.access_token
|
||||
};
|
||||
return { headers };
|
||||
}
|
||||
if (this.apiKey) {
|
||||
return { headers: {} };
|
||||
}
|
||||
let r = null;
|
||||
let tokens = null;
|
||||
try {
|
||||
r = yield this.refreshToken(thisCreds.refresh_token);
|
||||
tokens = r.tokens;
|
||||
}
|
||||
catch (err) {
|
||||
const e = err;
|
||||
if (e.response &&
|
||||
(e.response.status === 403 || e.response.status === 404)) {
|
||||
e.message = 'Could not refresh access token.';
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
const credentials = this.credentials;
|
||||
credentials.token_type = credentials.token_type || 'Bearer';
|
||||
tokens.refresh_token = credentials.refresh_token;
|
||||
this.credentials = tokens;
|
||||
const headers = {
|
||||
Authorization: credentials.token_type + ' ' + tokens.access_token
|
||||
};
|
||||
return { headers, res: r.res };
|
||||
});
|
||||
}
|
||||
revokeToken(token, callback) {
|
||||
const opts = {
|
||||
url: OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_ + '?' +
|
||||
querystring.stringify({ token })
|
||||
};
|
||||
if (callback) {
|
||||
this.transporter.request(opts).then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.transporter.request(opts);
|
||||
}
|
||||
}
|
||||
revokeCredentials(callback) {
|
||||
if (callback) {
|
||||
this.revokeCredentialsAsync().then(res => callback(null, res), callback);
|
||||
}
|
||||
else {
|
||||
return this.revokeCredentialsAsync();
|
||||
}
|
||||
}
|
||||
revokeCredentialsAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const token = this.credentials.access_token;
|
||||
this.credentials = {};
|
||||
if (token) {
|
||||
return this.revokeToken(token);
|
||||
}
|
||||
else {
|
||||
throw new Error('No access token to revoke.');
|
||||
}
|
||||
});
|
||||
}
|
||||
request(opts, callback) {
|
||||
if (callback) {
|
||||
this.requestAsync(opts).then(r => callback(null, r), e => {
|
||||
return callback(e, e.response);
|
||||
});
|
||||
}
|
||||
else {
|
||||
return this.requestAsync(opts);
|
||||
}
|
||||
}
|
||||
requestAsync(opts, retry = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let r2;
|
||||
try {
|
||||
const r = yield this.getRequestMetadataAsync(opts.url);
|
||||
if (r.headers && r.headers.Authorization) {
|
||||
opts.headers = opts.headers || {};
|
||||
opts.headers.Authorization = r.headers.Authorization;
|
||||
}
|
||||
if (this.apiKey) {
|
||||
opts.params = Object.assign(opts.params || {}, { key: this.apiKey });
|
||||
}
|
||||
r2 = yield this.transporter.request(opts);
|
||||
}
|
||||
catch (e) {
|
||||
const res = e.response;
|
||||
if (res) {
|
||||
const statusCode = res.status;
|
||||
// Retry the request for metadata if the following criteria are true:
|
||||
// - We haven't already retried. It only makes sense to retry once.
|
||||
// - The response was a 401 or a 403
|
||||
// - The request didn't send a readableStream
|
||||
// - An access_token and refresh_token were available, but no
|
||||
// expiry_date was availabe. This can happen when developers stash
|
||||
// the access_token and refresh_token for later use, but the
|
||||
// access_token fails on the first try because it's expired.
|
||||
const mayRequireRefresh = this.credentials &&
|
||||
this.credentials.access_token && this.credentials.refresh_token &&
|
||||
!this.credentials.expiry_date;
|
||||
const isReadableStream = res.config.data instanceof stream.Readable;
|
||||
const isAuthErr = statusCode === 401 || statusCode === 403;
|
||||
if (!retry && isAuthErr && !isReadableStream && mayRequireRefresh) {
|
||||
yield this.refreshAccessTokenAsync();
|
||||
return this.requestAsync(opts, true);
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return r2;
|
||||
});
|
||||
}
|
||||
verifyIdToken(options, callback) {
|
||||
// This function used to accept two arguments instead of an options object.
|
||||
// Check the types to help users upgrade with less pain.
|
||||
// This check can be removed after a 2.0 release.
|
||||
if (callback && typeof callback !== 'function') {
|
||||
throw new Error('This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.');
|
||||
}
|
||||
if (callback) {
|
||||
this.verifyIdTokenAsync(options).then(r => callback(null, r), callback);
|
||||
}
|
||||
else {
|
||||
return this.verifyIdTokenAsync(options);
|
||||
}
|
||||
}
|
||||
verifyIdTokenAsync(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!options.idToken) {
|
||||
throw new Error('The verifyIdToken method requires an ID Token');
|
||||
}
|
||||
const response = yield this.getFederatedSignonCertsAsync();
|
||||
const login = this.verifySignedJwtWithCerts(options.idToken, response.certs, options.audience, OAuth2Client.ISSUERS_, options.maxExpiry);
|
||||
return login;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Obtains information about the provisioned access token. Especially useful
|
||||
* if you want to check the scopes that were provisioned to a given token.
|
||||
*
|
||||
* @param accessToken Required. The Access Token for which you want to get
|
||||
* user info.
|
||||
*/
|
||||
getTokenInfo(accessToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { data } = yield this.transporter.request({
|
||||
method: 'GET',
|
||||
url: OAuth2Client.GOOGLE_TOKEN_INFO_URL,
|
||||
params: { access_token: accessToken }
|
||||
});
|
||||
const info = Object.assign({
|
||||
expiry_date: ((new Date()).getTime() + (data.expires_in * 1000)),
|
||||
scopes: data.scope.split(' ')
|
||||
}, data);
|
||||
delete info.expires_in;
|
||||
delete info.scope;
|
||||
return info;
|
||||
});
|
||||
}
|
||||
getFederatedSignonCerts(callback) {
|
||||
if (callback) {
|
||||
this.getFederatedSignonCertsAsync().then(r => callback(null, r.certs, r.res), callback);
|
||||
}
|
||||
else {
|
||||
return this.getFederatedSignonCertsAsync();
|
||||
}
|
||||
}
|
||||
getFederatedSignonCertsAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const nowTime = (new Date()).getTime();
|
||||
if (this.certificateExpiry &&
|
||||
(nowTime < this.certificateExpiry.getTime())) {
|
||||
return { certs: this.certificateCache };
|
||||
}
|
||||
let res;
|
||||
try {
|
||||
res = yield this.transporter.request({ url: OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_CERTS_URL_ });
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error('Failed to retrieve verification certificates: ' + e);
|
||||
}
|
||||
const cacheControl = res ? res.headers['cache-control'] : undefined;
|
||||
let cacheAge = -1;
|
||||
if (cacheControl) {
|
||||
const pattern = new RegExp('max-age=([0-9]*)');
|
||||
const regexResult = pattern.exec(cacheControl);
|
||||
if (regexResult && regexResult.length === 2) {
|
||||
// Cache results with max-age (in seconds)
|
||||
cacheAge = Number(regexResult[1]) * 1000; // milliseconds
|
||||
}
|
||||
}
|
||||
const now = new Date();
|
||||
this.certificateExpiry =
|
||||
cacheAge === -1 ? null : new Date(now.getTime() + cacheAge);
|
||||
this.certificateCache = res.data;
|
||||
return { certs: res.data, res };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Verify the id token is signed with the correct certificate
|
||||
* and is from the correct audience.
|
||||
* @param jwt The jwt to verify (The ID Token in this case).
|
||||
* @param certs The array of certs to test the jwt against.
|
||||
* @param requiredAudience The audience to test the jwt against.
|
||||
* @param issuers The allowed issuers of the jwt (Optional).
|
||||
* @param maxExpiry The max expiry the certificate can be (Optional).
|
||||
* @return Returns a LoginTicket on verification.
|
||||
*/
|
||||
verifySignedJwtWithCerts(jwt, certs, requiredAudience, issuers, maxExpiry) {
|
||||
if (!maxExpiry) {
|
||||
maxExpiry = OAuth2Client.MAX_TOKEN_LIFETIME_SECS_;
|
||||
}
|
||||
const segments = jwt.split('.');
|
||||
if (segments.length !== 3) {
|
||||
throw new Error('Wrong number of segments in token: ' + jwt);
|
||||
}
|
||||
const signed = segments[0] + '.' + segments[1];
|
||||
const signature = segments[2];
|
||||
let envelope;
|
||||
let payload;
|
||||
try {
|
||||
envelope = JSON.parse(this.decodeBase64(segments[0]));
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('Can\'t parse token envelope: ' + segments[0]);
|
||||
}
|
||||
if (!envelope) {
|
||||
throw new Error('Can\'t parse token envelope: ' + segments[0]);
|
||||
}
|
||||
try {
|
||||
payload = JSON.parse(this.decodeBase64(segments[1]));
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('Can\'t parse token payload: ' + segments[0]);
|
||||
}
|
||||
if (!payload) {
|
||||
throw new Error('Can\'t parse token payload: ' + segments[1]);
|
||||
}
|
||||
if (!certs.hasOwnProperty(envelope.kid)) {
|
||||
// If this is not present, then there's no reason to attempt verification
|
||||
throw new Error('No pem found for envelope: ' + JSON.stringify(envelope));
|
||||
}
|
||||
const pem = certs[envelope.kid];
|
||||
const pemVerifier = new pemverifier_1.PemVerifier();
|
||||
const verified = pemVerifier.verify(pem, signed, signature, 'base64');
|
||||
if (!verified) {
|
||||
throw new Error('Invalid token signature: ' + jwt);
|
||||
}
|
||||
if (!payload.iat) {
|
||||
throw new Error('No issue time in token: ' + JSON.stringify(payload));
|
||||
}
|
||||
if (!payload.exp) {
|
||||
throw new Error('No expiration time in token: ' + JSON.stringify(payload));
|
||||
}
|
||||
const iat = Number(payload.iat);
|
||||
if (isNaN(iat))
|
||||
throw new Error('iat field using invalid format');
|
||||
const exp = Number(payload.exp);
|
||||
if (isNaN(exp))
|
||||
throw new Error('exp field using invalid format');
|
||||
const now = new Date().getTime() / 1000;
|
||||
if (exp >= now + maxExpiry) {
|
||||
throw new Error('Expiration time too far in future: ' + JSON.stringify(payload));
|
||||
}
|
||||
const earliest = iat - OAuth2Client.CLOCK_SKEW_SECS_;
|
||||
const latest = exp + OAuth2Client.CLOCK_SKEW_SECS_;
|
||||
if (now < earliest) {
|
||||
throw new Error('Token used too early, ' + now + ' < ' + earliest + ': ' +
|
||||
JSON.stringify(payload));
|
||||
}
|
||||
if (now > latest) {
|
||||
throw new Error('Token used too late, ' + now + ' > ' + latest + ': ' +
|
||||
JSON.stringify(payload));
|
||||
}
|
||||
if (issuers && issuers.indexOf(payload.iss) < 0) {
|
||||
throw new Error('Invalid issuer, expected one of [' + issuers + '], but got ' +
|
||||
payload.iss);
|
||||
}
|
||||
// Check the audience matches if we have one
|
||||
if (typeof requiredAudience !== 'undefined' && requiredAudience !== null) {
|
||||
const aud = payload.aud;
|
||||
let audVerified = false;
|
||||
// If the requiredAudience is an array, check if it contains token
|
||||
// audience
|
||||
if (requiredAudience.constructor === Array) {
|
||||
audVerified = (requiredAudience.indexOf(aud) > -1);
|
||||
}
|
||||
else {
|
||||
audVerified = (aud === requiredAudience);
|
||||
}
|
||||
if (!audVerified) {
|
||||
throw new Error('Wrong recipient, payload audience != requiredAudience');
|
||||
}
|
||||
}
|
||||
return new loginticket_1.LoginTicket(envelope, payload);
|
||||
}
|
||||
/**
|
||||
* This is a utils method to decode a base64 string
|
||||
* @param b64String The string to base64 decode
|
||||
* @return The decoded string
|
||||
*/
|
||||
decodeBase64(b64String) {
|
||||
const buffer = Buffer.from(b64String, 'base64');
|
||||
return buffer.toString('utf8');
|
||||
}
|
||||
/**
|
||||
* Returns true if a token is expired or will expire within
|
||||
* eagerRefreshThresholdMillismilliseconds.
|
||||
* If there is no expiry time, assumes the token is not expired or expiring.
|
||||
*/
|
||||
isTokenExpiring() {
|
||||
const expiryDate = this.credentials.expiry_date;
|
||||
return expiryDate ? expiryDate <=
|
||||
((new Date()).getTime() + this.eagerRefreshThresholdMillis) :
|
||||
false;
|
||||
}
|
||||
}
|
||||
OAuth2Client.GOOGLE_TOKEN_INFO_URL = 'https://oauth2.googleapis.com/tokeninfo';
|
||||
/**
|
||||
* The base URL for auth endpoints.
|
||||
*/
|
||||
OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_ = 'https://accounts.google.com/o/oauth2/v2/auth';
|
||||
/**
|
||||
* The base endpoint for token retrieval.
|
||||
*/
|
||||
OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_ = 'https://oauth2.googleapis.com/token';
|
||||
/**
|
||||
* The base endpoint to revoke tokens.
|
||||
*/
|
||||
OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_ = 'https://oauth2.googleapis.com/revoke';
|
||||
/**
|
||||
* Google Sign on certificates.
|
||||
*/
|
||||
OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_CERTS_URL_ = 'https://www.googleapis.com/oauth2/v1/certs';
|
||||
/**
|
||||
* Clock skew - five minutes in seconds
|
||||
*/
|
||||
OAuth2Client.CLOCK_SKEW_SECS_ = 300;
|
||||
/**
|
||||
* Max Token Lifetime is one day in seconds
|
||||
*/
|
||||
OAuth2Client.MAX_TOKEN_LIFETIME_SECS_ = 86400;
|
||||
/**
|
||||
* The allowed oauth token issuers.
|
||||
*/
|
||||
OAuth2Client.ISSUERS_ = ['accounts.google.com', 'https://accounts.google.com'];
|
||||
exports.OAuth2Client = OAuth2Client;
|
||||
//# sourceMappingURL=oauth2client.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/oauth2client.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
58
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts
generated
vendored
Normal file
58
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
import { JWTInput } from './credentials';
|
||||
import { GetTokenResponse, OAuth2Client, RefreshOptions } from './oauth2client';
|
||||
export interface UserRefreshClientOptions extends RefreshOptions {
|
||||
clientId?: string;
|
||||
clientSecret?: string;
|
||||
refreshToken?: string;
|
||||
}
|
||||
export declare class UserRefreshClient extends OAuth2Client {
|
||||
_refreshToken?: string | null;
|
||||
/**
|
||||
* User Refresh Token credentials.
|
||||
*
|
||||
* @param clientId The authentication client ID.
|
||||
* @param clientSecret The authentication client secret.
|
||||
* @param refreshToken The authentication refresh token.
|
||||
*/
|
||||
constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
|
||||
constructor(options: UserRefreshClientOptions);
|
||||
constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken An ignored refreshToken..
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
|
||||
/**
|
||||
* Create a UserRefreshClient credentials instance using the given input
|
||||
* options.
|
||||
* @param json The input object.
|
||||
*/
|
||||
fromJSON(json: JWTInput): void;
|
||||
/**
|
||||
* Create a UserRefreshClient credentials instance using the given input
|
||||
* stream.
|
||||
* @param inputStream The input stream.
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
fromStream(inputStream: stream.Readable): Promise<void>;
|
||||
fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
|
||||
private fromStreamAsync;
|
||||
}
|
114
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.js
generated
vendored
Normal file
114
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.js
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const oauth2client_1 = require("./oauth2client");
|
||||
class UserRefreshClient extends oauth2client_1.OAuth2Client {
|
||||
constructor(optionsOrClientId, clientSecret, refreshToken, eagerRefreshThresholdMillis) {
|
||||
const opts = (optionsOrClientId && typeof optionsOrClientId === 'object') ?
|
||||
optionsOrClientId :
|
||||
{
|
||||
clientId: optionsOrClientId,
|
||||
clientSecret,
|
||||
refreshToken,
|
||||
eagerRefreshThresholdMillis
|
||||
};
|
||||
super({
|
||||
clientId: opts.clientId,
|
||||
clientSecret: opts.clientSecret,
|
||||
eagerRefreshThresholdMillis: opts.eagerRefreshThresholdMillis
|
||||
});
|
||||
this._refreshToken = opts.refreshToken;
|
||||
}
|
||||
/**
|
||||
* Refreshes the access token.
|
||||
* @param refreshToken An ignored refreshToken..
|
||||
* @param callback Optional callback.
|
||||
*/
|
||||
refreshTokenNoCache(refreshToken) {
|
||||
const _super = name => super[name];
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return _super("refreshTokenNoCache").call(this, this._refreshToken);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create a UserRefreshClient 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 user refresh token');
|
||||
}
|
||||
if (json.type !== 'authorized_user') {
|
||||
throw new Error('The incoming JSON object does not have the "authorized_user" type');
|
||||
}
|
||||
if (!json.client_id) {
|
||||
throw new Error('The incoming JSON object does not contain a client_id field');
|
||||
}
|
||||
if (!json.client_secret) {
|
||||
throw new Error('The incoming JSON object does not contain a client_secret field');
|
||||
}
|
||||
if (!json.refresh_token) {
|
||||
throw new Error('The incoming JSON object does not contain a refresh_token field');
|
||||
}
|
||||
this._clientId = json.client_id;
|
||||
this._clientSecret = json.client_secret;
|
||||
this._refreshToken = json.refresh_token;
|
||||
this.credentials.refresh_token = json.refresh_token;
|
||||
}
|
||||
fromStream(inputStream, callback) {
|
||||
if (callback) {
|
||||
this.fromStreamAsync(inputStream).then(r => callback(), callback);
|
||||
}
|
||||
else {
|
||||
return this.fromStreamAsync(inputStream);
|
||||
}
|
||||
}
|
||||
fromStreamAsync(inputStream) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!inputStream) {
|
||||
return reject(new Error('Must pass in a stream containing the user refresh token.'));
|
||||
}
|
||||
let s = '';
|
||||
inputStream.setEncoding('utf8')
|
||||
.on('error', reject)
|
||||
.on('data', (chunk) => s += chunk)
|
||||
.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(s);
|
||||
this.fromJSON(data);
|
||||
return resolve();
|
||||
}
|
||||
catch (err) {
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.UserRefreshClient = UserRefreshClient;
|
||||
//# sourceMappingURL=refreshclient.js.map
|
1
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/auth/refreshclient.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"refreshclient.js","sourceRoot":"","sources":["../../../src/auth/refreshclient.ts"],"names":[],"mappings":"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"}
|
27
express-server/node_modules/google-auth-library/build/src/index.d.ts
generated
vendored
Normal file
27
express-server/node_modules/google-auth-library/build/src/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import { GoogleAuth } from './auth/googleauth';
|
||||
export { Compute, ComputeOptions } from './auth/computeclient';
|
||||
export { Credentials } from './auth/credentials';
|
||||
export { GoogleAuthOptions } from './auth/googleauth';
|
||||
export { IAMAuth } from './auth/iam';
|
||||
export { JWTAccess } from './auth/jwtaccess';
|
||||
export { JWT } from './auth/jwtclient';
|
||||
export { CodeChallengeMethod, OAuth2Client } from './auth/oauth2client';
|
||||
export { UserRefreshClient } from './auth/refreshclient';
|
||||
export { DefaultTransporter } from './transporters';
|
||||
declare const auth: GoogleAuth;
|
||||
export { auth, GoogleAuth };
|
37
express-server/node_modules/google-auth-library/build/src/index.js
generated
vendored
Normal file
37
express-server/node_modules/google-auth-library/build/src/index.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
const googleauth_1 = require("./auth/googleauth");
|
||||
exports.GoogleAuth = googleauth_1.GoogleAuth;
|
||||
var computeclient_1 = require("./auth/computeclient");
|
||||
exports.Compute = computeclient_1.Compute;
|
||||
var iam_1 = require("./auth/iam");
|
||||
exports.IAMAuth = iam_1.IAMAuth;
|
||||
var jwtaccess_1 = require("./auth/jwtaccess");
|
||||
exports.JWTAccess = jwtaccess_1.JWTAccess;
|
||||
var jwtclient_1 = require("./auth/jwtclient");
|
||||
exports.JWT = jwtclient_1.JWT;
|
||||
var oauth2client_1 = require("./auth/oauth2client");
|
||||
exports.CodeChallengeMethod = oauth2client_1.CodeChallengeMethod;
|
||||
exports.OAuth2Client = oauth2client_1.OAuth2Client;
|
||||
var refreshclient_1 = require("./auth/refreshclient");
|
||||
exports.UserRefreshClient = refreshclient_1.UserRefreshClient;
|
||||
var transporters_1 = require("./transporters");
|
||||
exports.DefaultTransporter = transporters_1.DefaultTransporter;
|
||||
const auth = new googleauth_1.GoogleAuth();
|
||||
exports.auth = auth;
|
||||
//# sourceMappingURL=index.js.map
|
1
express-server/node_modules/google-auth-library/build/src/index.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACH,kDAA6C;AAa/B,qBAbN,uBAAU,CAaM;AAXxB,sDAA6D;AAArD,kCAAA,OAAO,CAAA;AAGf,kCAAmC;AAA3B,wBAAA,OAAO,CAAA;AACf,8CAA2C;AAAnC,gCAAA,SAAS,CAAA;AACjB,8CAAqC;AAA7B,0BAAA,GAAG,CAAA;AACX,oDAAsE;AAA9D,6CAAA,mBAAmB,CAAA;AAAE,sCAAA,YAAY,CAAA;AACzC,sDAAuD;AAA/C,4CAAA,iBAAiB,CAAA;AACzB,+CAAkD;AAA1C,4CAAA,kBAAkB,CAAA;AAE1B,MAAM,IAAI,GAAG,IAAI,uBAAU,EAAE,CAAC;AACtB,oBAAI"}
|
76
express-server/node_modules/google-auth-library/build/src/messages.d.ts
generated
vendored
Normal file
76
express-server/node_modules/google-auth-library/build/src/messages.d.ts
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Copyright 2018 Google LLC. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export declare enum WarningTypes {
|
||||
WARNING = "Warning",
|
||||
DEPRECATION = "DeprecationWarning"
|
||||
}
|
||||
export declare function warn(warning: Warning): void;
|
||||
export interface Warning {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
warned?: boolean;
|
||||
}
|
||||
export declare const PROBLEMATIC_CREDENTIALS_WARNING: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const DEFAULT_PROJECT_ID_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const COMPUTE_CREATE_SCOPED_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const JWT_CREATE_SCOPED_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const IAM_CREATE_SCOPED_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const JWT_ACCESS_CREATE_SCOPED_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const REFRESH_ACCESS_TOKEN_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const OAUTH_GET_REQUEST_METADATA_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const IAM_GET_REQUEST_METADATA_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
||||
export declare const JWT_ACCESS_GET_REQUEST_METADATA_DEPRECATED: {
|
||||
code: string;
|
||||
type: WarningTypes;
|
||||
message: string;
|
||||
};
|
133
express-server/node_modules/google-auth-library/build/src/messages.js
generated
vendored
Normal file
133
express-server/node_modules/google-auth-library/build/src/messages.js
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2018 Google LLC. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const semver = require("semver");
|
||||
var WarningTypes;
|
||||
(function (WarningTypes) {
|
||||
WarningTypes["WARNING"] = "Warning";
|
||||
WarningTypes["DEPRECATION"] = "DeprecationWarning";
|
||||
})(WarningTypes = exports.WarningTypes || (exports.WarningTypes = {}));
|
||||
function warn(warning) {
|
||||
// Only show a given warning once
|
||||
if (warning.warned) {
|
||||
return;
|
||||
}
|
||||
warning.warned = true;
|
||||
if (semver.satisfies(process.version, '>=8')) {
|
||||
// @types/node doesn't recognize the emitWarning syntax which
|
||||
// accepts a config object, so `as any` it is
|
||||
// https://nodejs.org/docs/latest-v8.x/api/process.html#process_process_emitwarning_warning_options
|
||||
// tslint:disable-next-line no-any
|
||||
process.emitWarning(warning.message, warning);
|
||||
}
|
||||
else {
|
||||
// This path can be removed once we drop support for Node 6.
|
||||
// https://nodejs.org/docs/latest-v6.x/api/process.html#process_process_emitwarning_warning_name_ctor
|
||||
process.emitWarning(warning.message, warning.type);
|
||||
}
|
||||
}
|
||||
exports.warn = warn;
|
||||
exports.PROBLEMATIC_CREDENTIALS_WARNING = {
|
||||
code: 'google-auth-library:00001',
|
||||
type: WarningTypes.WARNING,
|
||||
message: [
|
||||
'Your application has authenticated using end user credentials from Google',
|
||||
'Cloud SDK. We recommend that most server applications use service accounts',
|
||||
'instead. If your application continues to use end user credentials from',
|
||||
'Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error.',
|
||||
'For more information about service accounts, see',
|
||||
'https://cloud.google.com/docs/authentication/.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.DEFAULT_PROJECT_ID_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP002',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `getDefaultProjectId` method has been deprecated, and will be removed',
|
||||
'in the 3.0 release of google-auth-library. Please use the `getProjectId`',
|
||||
'method instead.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.COMPUTE_CREATE_SCOPED_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP003',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `createScopedRequired` method on the `Compute` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.JWT_CREATE_SCOPED_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP004',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `createScopedRequired` method on the `JWT` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.IAM_CREATE_SCOPED_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP005',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `createScopedRequired` method on the `IAM` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.JWT_ACCESS_CREATE_SCOPED_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP006',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `createScopedRequired` method on the `JWTAccess` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.REFRESH_ACCESS_TOKEN_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP007',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `refreshAccessToken` method has been deprecated, and will be removed',
|
||||
'in the 3.0 release of google-auth-library. Please use the `getRequestHeaders`',
|
||||
'method instead.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.OAUTH_GET_REQUEST_METADATA_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP004',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `getRequestMetadata` method on the `OAuth2` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library. Please use',
|
||||
'the `getRequestHeaders` method instead.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.IAM_GET_REQUEST_METADATA_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP005',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `getRequestMetadata` method on the `IAM` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library. Please use',
|
||||
'the `getRequestHeaders` method instead.'
|
||||
].join(' ')
|
||||
};
|
||||
exports.JWT_ACCESS_GET_REQUEST_METADATA_DEPRECATED = {
|
||||
code: 'google-auth-library:DEP006',
|
||||
type: WarningTypes.DEPRECATION,
|
||||
message: [
|
||||
'The `getRequestMetadata` method on the `JWTAccess` class has been deprecated,',
|
||||
'and will be removed in the 3.0 release of google-auth-library. Please use',
|
||||
'the `getRequestHeaders` method instead.'
|
||||
].join(' ')
|
||||
};
|
||||
//# sourceMappingURL=messages.js.map
|
1
express-server/node_modules/google-auth-library/build/src/messages.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/messages.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"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"}
|
16
express-server/node_modules/google-auth-library/build/src/options.d.ts
generated
vendored
Normal file
16
express-server/node_modules/google-auth-library/build/src/options.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
export declare function validate(options: any): void;
|
36
express-server/node_modules/google-auth-library/build/src/options.js
generated
vendored
Normal file
36
express-server/node_modules/google-auth-library/build/src/options.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
// Accepts an options object passed from the user to the API. In the
|
||||
// previous version of the API, it referred to a `Request` options object.
|
||||
// Now it refers to an Axiox Request Config object. This is here to help
|
||||
// ensure users don't pass invalid options when they upgrade from 0.x to 1.x.
|
||||
// tslint:disable-next-line no-any
|
||||
function validate(options) {
|
||||
const vpairs = [
|
||||
{ invalid: 'uri', expected: 'url' }, { invalid: 'json', expected: 'data' },
|
||||
{ invalid: 'qs', expected: 'params' }
|
||||
];
|
||||
for (const pair of vpairs) {
|
||||
if (options[pair.invalid]) {
|
||||
const e = `'${pair.invalid}' is not a valid configuration option. Please use '${pair.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.validate = validate;
|
||||
//# sourceMappingURL=options.js.map
|
1
express-server/node_modules/google-auth-library/build/src/options.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/options.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,qEAAqE;AACrE,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,kCAAkC;AAClC,SAAgB,QAAQ,CAAC,OAAY;IACnC,MAAM,MAAM,GAAG;QACb,EAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAC,EAAE,EAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAC;QACtE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAC;KACpC,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;QACzB,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YACzB,MAAM,CAAC,GAAG,IACN,IAAI,CAAC,OAAO,sDACZ,IAAI,CAAC,QAAQ,+IAA+I,CAAC;YACjK,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;KACF;AACH,CAAC;AAbD,4BAaC"}
|
20
express-server/node_modules/google-auth-library/build/src/pemverifier.d.ts
generated
vendored
Normal file
20
express-server/node_modules/google-auth-library/build/src/pemverifier.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import * as crypto from 'crypto';
|
||||
export declare class PemVerifier {
|
||||
verify(pubkey: string, data: string | Buffer, signature: string, encoding: crypto.HexBase64Latin1Encoding): boolean;
|
||||
}
|
27
express-server/node_modules/google-auth-library/build/src/pemverifier.js
generated
vendored
Normal file
27
express-server/node_modules/google-auth-library/build/src/pemverifier.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2014 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const crypto = require("crypto");
|
||||
class PemVerifier {
|
||||
verify(pubkey, data, signature, encoding) {
|
||||
const verifier = crypto.createVerify('sha256');
|
||||
verifier.update(data);
|
||||
return verifier.verify(pubkey, signature, encoding);
|
||||
}
|
||||
}
|
||||
exports.PemVerifier = PemVerifier;
|
||||
//# sourceMappingURL=pemverifier.js.map
|
1
express-server/node_modules/google-auth-library/build/src/pemverifier.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/pemverifier.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"pemverifier.js","sourceRoot":"","sources":["../../src/pemverifier.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,iCAAiC;AAEjC,MAAa,WAAW;IACtB,MAAM,CACF,MAAc,EAAE,IAAmB,EAAE,SAAiB,EACtD,QAAwC;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC/C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;CACF;AARD,kCAQC"}
|
51
express-server/node_modules/google-auth-library/build/src/transporters.d.ts
generated
vendored
Normal file
51
express-server/node_modules/google-auth-library/build/src/transporters.d.ts
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import { AxiosError, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
export interface Transporter {
|
||||
request<T>(opts: AxiosRequestConfig): AxiosPromise<T>;
|
||||
request<T>(opts: AxiosRequestConfig, callback?: BodyResponseCallback<T>): void;
|
||||
request<T>(opts: AxiosRequestConfig, callback?: BodyResponseCallback<T>): AxiosPromise | void;
|
||||
}
|
||||
export interface BodyResponseCallback<T> {
|
||||
(err: Error | null, res?: AxiosResponse<T> | null): void;
|
||||
}
|
||||
export interface RequestError extends AxiosError {
|
||||
errors: Error[];
|
||||
}
|
||||
export declare class DefaultTransporter {
|
||||
/**
|
||||
* Default user agent.
|
||||
*/
|
||||
static readonly USER_AGENT: string;
|
||||
/**
|
||||
* Configures request options before making a request.
|
||||
* @param opts AxiosRequestConfig options.
|
||||
* @return Configured options.
|
||||
*/
|
||||
configure(opts?: AxiosRequestConfig): AxiosRequestConfig;
|
||||
/**
|
||||
* Makes a request using Axios with given options.
|
||||
* @param opts AxiosRequestConfig options.
|
||||
* @param callback optional callback that contains AxiosResponse object.
|
||||
* @return AxiosPromise, assuming no callback is passed.
|
||||
*/
|
||||
request<T>(opts: AxiosRequestConfig): AxiosPromise<T>;
|
||||
request<T>(opts: AxiosRequestConfig, callback?: BodyResponseCallback<T>): void;
|
||||
/**
|
||||
* Changes the error to include details from the body.
|
||||
*/
|
||||
private processError;
|
||||
}
|
122
express-server/node_modules/google-auth-library/build/src/transporters.js
generated
vendored
Normal file
122
express-server/node_modules/google-auth-library/build/src/transporters.js
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 });
|
||||
const axios_1 = require("axios");
|
||||
const options_1 = require("./options");
|
||||
// tslint:disable-next-line variable-name
|
||||
const HttpsProxyAgent = require('https-proxy-agent');
|
||||
// tslint:disable-next-line no-var-requires
|
||||
const pkg = require('../../package.json');
|
||||
const PRODUCT_NAME = 'google-api-nodejs-client';
|
||||
/**
|
||||
* Axios will use XHR if it is available. In the case of Electron,
|
||||
* since XHR is there it will try to use that. This leads to OPTIONS
|
||||
* preflight requests which googleapis DOES NOT like. This line of
|
||||
* code pins the adapter to ensure it uses node.
|
||||
* https://github.com/google/google-api-nodejs-client/issues/1083
|
||||
*/
|
||||
axios_1.default.defaults.adapter = require('axios/lib/adapters/http');
|
||||
class DefaultTransporter {
|
||||
/**
|
||||
* Configures request options before making a request.
|
||||
* @param opts AxiosRequestConfig options.
|
||||
* @return Configured options.
|
||||
*/
|
||||
configure(opts = {}) {
|
||||
// set transporter user agent
|
||||
opts.headers = opts.headers || {};
|
||||
const uaValue = opts.headers['User-Agent'];
|
||||
if (!uaValue) {
|
||||
opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT;
|
||||
}
|
||||
else if (!uaValue.includes(`${PRODUCT_NAME}/`)) {
|
||||
opts.headers['User-Agent'] =
|
||||
`${uaValue} ${DefaultTransporter.USER_AGENT}`;
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
request(opts, callback) {
|
||||
// ensure the user isn't passing in request-style options
|
||||
opts = this.configure(opts);
|
||||
try {
|
||||
options_1.validate(opts);
|
||||
}
|
||||
catch (e) {
|
||||
if (callback) {
|
||||
return callback(e);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// If the user configured an `HTTPS_PROXY` environment variable, create
|
||||
// a custom agent to proxy the request.
|
||||
const proxy = process.env.HTTPS_PROXY || process.env.https_proxy;
|
||||
if (proxy) {
|
||||
opts.httpsAgent = new HttpsProxyAgent(proxy);
|
||||
opts.proxy = false;
|
||||
}
|
||||
if (callback) {
|
||||
axios_1.default(opts).then(r => {
|
||||
callback(null, r);
|
||||
}, e => {
|
||||
callback(this.processError(e));
|
||||
});
|
||||
}
|
||||
else {
|
||||
return axios_1.default(opts).catch(e => {
|
||||
throw this.processError(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Changes the error to include details from the body.
|
||||
*/
|
||||
processError(e) {
|
||||
const res = e.response;
|
||||
const err = e;
|
||||
const body = res ? res.data : null;
|
||||
if (res && body && body.error && res.status !== 200) {
|
||||
if (typeof body.error === 'string') {
|
||||
err.message = body.error;
|
||||
err.code = res.status.toString();
|
||||
}
|
||||
else if (Array.isArray(body.error.errors)) {
|
||||
err.message =
|
||||
body.error.errors.map((err2) => err2.message).join('\n');
|
||||
err.code = body.error.code;
|
||||
err.errors = body.error.errors;
|
||||
}
|
||||
else {
|
||||
err.message = body.error.message;
|
||||
err.code = body.error.code || res.status;
|
||||
}
|
||||
}
|
||||
else if (res && res.status >= 400) {
|
||||
// Consider all 4xx and 5xx responses errors.
|
||||
err.message = body;
|
||||
err.code = res.status.toString();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Default user agent.
|
||||
*/
|
||||
DefaultTransporter.USER_AGENT = `${PRODUCT_NAME}/${pkg.version}`;
|
||||
exports.DefaultTransporter = DefaultTransporter;
|
||||
//# sourceMappingURL=transporters.js.map
|
1
express-server/node_modules/google-auth-library/build/src/transporters.js.map
generated
vendored
Normal file
1
express-server/node_modules/google-auth-library/build/src/transporters.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"transporters.js","sourceRoot":"","sources":["../../src/transporters.ts"],"names":[],"mappings":"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"}
|
Reference in New Issue
Block a user