Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

google-auth-library

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-auth-library - npm Package Compare versions

Comparing version
9.6.3
to
9.7.0
+38
build/src/auth/passthrough.d.ts
import { GaxiosOptions } from 'gaxios';
import { AuthClient } from './authclient';
import { GetAccessTokenResponse, Headers } from './oauth2client';
/**
* An AuthClient without any Authentication information. Useful for:
* - Anonymous access
* - Local Emulators
* - Testing Environments
*
*/
export declare class PassThroughClient extends AuthClient {
/**
* Creates a request without any authentication headers or checks.
*
* @remarks
*
* In testing environments it may be useful to change the provided
* {@link AuthClient.transporter} for any desired request overrides/handling.
*
* @param opts
* @returns The response of the request.
*/
request<T>(opts: GaxiosOptions): Promise<import("gaxios").GaxiosResponse<T>>;
/**
* A required method of the base class.
* Always will return an empty object.
*
* @returns {}
*/
getAccessToken(): Promise<GetAccessTokenResponse>;
/**
* A required method of the base class.
* Always will return an empty object.
*
* @returns {}
*/
getRequestHeaders(): Promise<Headers>;
}
"use strict";
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.PassThroughClient = void 0;
const authclient_1 = require("./authclient");
/**
* An AuthClient without any Authentication information. Useful for:
* - Anonymous access
* - Local Emulators
* - Testing Environments
*
*/
class PassThroughClient extends authclient_1.AuthClient {
/**
* Creates a request without any authentication headers or checks.
*
* @remarks
*
* In testing environments it may be useful to change the provided
* {@link AuthClient.transporter} for any desired request overrides/handling.
*
* @param opts
* @returns The response of the request.
*/
async request(opts) {
return this.transporter.request(opts);
}
/**
* A required method of the base class.
* Always will return an empty object.
*
* @returns {}
*/
async getAccessToken() {
return {};
}
/**
* A required method of the base class.
* Always will return an empty object.
*
* @returns {}
*/
async getRequestHeaders() {
return {};
}
}
exports.PassThroughClient = PassThroughClient;
const a = new PassThroughClient();
a.getAccessToken();
+2
-5

@@ -6,3 +6,3 @@ /// <reference types="node" />

import { Credentials } from './credentials';
import { Headers } from './oauth2client';
import { GetAccessTokenResponse, Headers } from './oauth2client';
import { OriginalAndCamel } from '../util';

@@ -99,6 +99,3 @@ /**

*/
getAccessToken(): Promise<{
token?: string | null;
res?: GaxiosResponse | null;
}>;
getAccessToken(): Promise<GetAccessTokenResponse>;
/**

@@ -105,0 +102,0 @@ * The main authentication interface. It takes an optional url which when

@@ -92,5 +92,4 @@ import { BaseExternalAccountClient, BaseExternalAccountClientOptions } from './baseexternalclient';

private getAwsSecurityCredentials;
private shouldUseMetadataServer;
private get regionFromEnv();
private get securityCredentialsFromEnv();
}

@@ -98,3 +98,3 @@ "use strict";

// Removing this check may break them.
if (this.shouldUseMetadataServer() && this.imdsV2SessionTokenUrl) {
if (!this.regionFromEnv && this.imdsV2SessionTokenUrl) {
metadataHeaders['x-aws-ec2-metadata-token'] =

@@ -110,2 +110,6 @@ await this.getImdsV2SessionToken();

}
if (this.imdsV2SessionTokenUrl) {
metadataHeaders['x-aws-ec2-metadata-token'] =
await this.getImdsV2SessionToken();
}
// Since the role on a VM can change, we don't need to cache it.

@@ -238,7 +242,2 @@ const roleName = await this.getAwsRoleName(metadataHeaders);

}
shouldUseMetadataServer() {
// The metadata server must be used when either the AWS region or AWS security
// credentials cannot be retrieved through their defined environment variables.
return !this.regionFromEnv || !this.securityCredentialsFromEnv;
}
get regionFromEnv() {

@@ -245,0 +244,0 @@ // The AWS region can be provided through AWS_REGION or AWS_DEFAULT_REGION.

@@ -464,3 +464,3 @@ /// <reference types="node" />

getRequestHeaders(url?: string): Promise<Headers>;
protected getRequestMetadataAsync(url?: string | null): Promise<RequestMetadataResponse>;
protected getRequestMetadataAsync(url?: string | URL | null): Promise<RequestMetadataResponse>;
/**

@@ -467,0 +467,0 @@ * Generates an URL to revoke the given token.

@@ -22,4 +22,5 @@ import { GoogleAuth } from './auth/googleauth';

export { PluggableAuthClient, PluggableAuthClientOptions, } from './auth/pluggable-auth-client';
export { PassThroughClient } from './auth/passthrough';
export { DefaultTransporter } from './transporters';
declare const auth: GoogleAuth<import("./auth/googleauth").JSONClient>;
export { auth, GoogleAuth };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gcpMetadata = void 0;
exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PassThroughClient = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gcpMetadata = void 0;
// Copyright 2017 Google LLC

@@ -56,2 +56,4 @@ //

Object.defineProperty(exports, "PluggableAuthClient", { enumerable: true, get: function () { return pluggable_auth_client_1.PluggableAuthClient; } });
var passthrough_1 = require("./auth/passthrough");
Object.defineProperty(exports, "PassThroughClient", { enumerable: true, get: function () { return passthrough_1.PassThroughClient; } });
var transporters_1 = require("./transporters");

@@ -58,0 +60,0 @@ Object.defineProperty(exports, "DefaultTransporter", { enumerable: true, get: function () { return transporters_1.DefaultTransporter; } });

{
"name": "google-auth-library",
"version": "9.6.3",
"version": "9.7.0",
"author": "Google Inc.",

@@ -5,0 +5,0 @@ "description": "Google APIs Authentication Client Library for Node.js",

Sorry, the diff of this file is too big to display