Skip to content

Commit

Permalink
chore(deps)!: upgrade node-gtoken to 7.0.0 (#1590)
Browse files Browse the repository at this point in the history
* chore(deps): upgrade node-gtoken to 7.0.0

* fix!: remove p12 functionality for auth

* revert

* chore: remove tests
  • Loading branch information
sofisl committed Jul 12, 2023
1 parent 1bf3376 commit 8738df9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 65 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ecdsa-sig-formatter": "^1.0.11",
"gaxios": "^5.0.0",
"gcp-metadata": "^5.3.0",
"gtoken": "^6.1.0",
"gtoken": "^7.0.0",
"jws": "^4.0.0",
"lru-cache": "^6.0.0"
},
Expand Down
57 changes: 0 additions & 57 deletions test/test.googleauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2544,25 +2544,6 @@ describe('googleauth', () => {
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});
it('allows client to be instantiated from p12 key file', async () => {
const auth = new GoogleAuth({
keyFile: P12_PATH,
clientOptions: {
scopes: 'http://foo',
email: 'foo@serviceaccount.com',
subject: 'bar@subjectaccount.com',
},
});
const jwt = await auth.getClient();
const scope = createGTokenMock({access_token: 'initial-access-token'});
const headers = await jwt.getRequestHeaders();
assert.deepStrictEqual(
headers.Authorization,
'Bearer initial-access-token'
);
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});

// Allows a client to be instantiated from a certificate,
// See: https://github.com/googleapis/google-auth-library-nodejs/issues/808
Expand All @@ -2585,25 +2566,6 @@ describe('googleauth', () => {
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});
it('allows client to be instantiated from p12 key file', async () => {
const auth = new GoogleAuth({
keyFile: P12_PATH,
clientOptions: {
scopes: 'http://foo',
email: 'foo@serviceaccount.com',
subject: 'bar@subjectaccount.com',
},
});
const jwt = await auth.getClient();
const scope = createGTokenMock({access_token: 'initial-access-token'});
const headers = await jwt.getRequestHeaders();
assert.deepStrictEqual(
headers.Authorization,
'Bearer initial-access-token'
);
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});

// Allows a client to be instantiated from a certificate,
// See: https://github.com/googleapis/google-auth-library-nodejs/issues/808
Expand All @@ -2626,23 +2588,4 @@ describe('googleauth', () => {
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});
it('allows client to be instantiated from p12 key file', async () => {
const auth = new GoogleAuth({
keyFile: P12_PATH,
clientOptions: {
scopes: 'http://foo',
email: 'foo@serviceaccount.com',
subject: 'bar@subjectaccount.com',
},
});
const jwt = await auth.getClient();
const scope = createGTokenMock({access_token: 'initial-access-token'});
const headers = await jwt.getRequestHeaders();
assert.deepStrictEqual(
headers.Authorization,
'Bearer initial-access-token'
);
scope.done();
assert.strictEqual('http://foo', (jwt as JWT).gtoken!.scope);
});
});
7 changes: 0 additions & 7 deletions test/test.jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,6 @@ describe('jwt', () => {
assert.strictEqual(private_key, PEM_CONTENTS);
});

it('getCredentials should handle a p12 keyFile', async () => {
const jwt = new JWT({keyFile: P12_PATH});
const {private_key, client_email} = await jwt.getCredentials();
assert(private_key);
assert.strictEqual(client_email, undefined);
});

it('getCredentials should handle a json keyFile', async () => {
const jwt = new JWT();
jwt.fromJSON(json);
Expand Down

0 comments on commit 8738df9

Please sign in to comment.