Skip to content

Commit 8829ddd

Browse files
authored
Merge branch 'main' into al-3
2 parents bf8ae38 + bcefe96 commit 8829ddd

File tree

6 files changed

+38
-5
lines changed

6 files changed

+38
-5
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
[1]: https://www.npmjs.com/package/google-auth-library?activeTab=versions
66

7+
## [9.5.0](https://github.com/googleapis/google-auth-library-nodejs/compare/v9.4.2...v9.5.0) (2024-01-25)
8+
9+
10+
### Features
11+
12+
* Improve Universe Domain Ergonomics ([#1732](https://github.com/googleapis/google-auth-library-nodejs/issues/1732)) ([eec82f5](https://github.com/googleapis/google-auth-library-nodejs/commit/eec82f5f48a250744b5c3200ef247c3eae184e2f))
13+
14+
15+
### Bug Fixes
16+
17+
* **deps:** Update dependency @googleapis/iam to v14 ([#1725](https://github.com/googleapis/google-auth-library-nodejs/issues/1725)) ([594bf2c](https://github.com/googleapis/google-auth-library-nodejs/commit/594bf2cc808c03733274d6b08d92f1d4b12dd630))
18+
* Typos in samples ([#1728](https://github.com/googleapis/google-auth-library-nodejs/issues/1728)) ([058a503](https://github.com/googleapis/google-auth-library-nodejs/commit/058a5035e3e4df35663c6b3adef2dda617271849))
19+
720
## [9.4.2](https://github.com/googleapis/google-auth-library-nodejs/compare/v9.4.1...v9.4.2) (2024-01-04)
821

922

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "google-auth-library",
3-
"version": "9.4.2",
3+
"version": "9.5.0",
44
"author": "Google Inc.",
55
"description": "Google APIs Authentication Client Library for Node.js",
66
"engines": {

samples/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@google-cloud/storage": "^7.0.0",
1717
"@googleapis/iam": "^14.0.0",
18-
"google-auth-library": "^9.4.2",
18+
"google-auth-library": "^9.5.0",
1919
"node-fetch": "^2.3.0",
2020
"opn": "^5.3.0",
2121
"server-destroy": "^1.0.1"

src/auth/googleauth.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ export interface GoogleAuthOptions<T extends AuthClient = JSONClient> {
122122
* Your project ID.
123123
*/
124124
projectId?: string;
125+
126+
/**
127+
* The default service domain for a given Cloud universe.
128+
*
129+
* This is an ergonomic equivalent to {@link clientOptions}'s `universeDomain`
130+
* property and will be set for all generated {@link AuthClient}s.
131+
*/
132+
universeDomain?: string;
125133
}
126134

127135
export const CLOUD_SDK_CLIENT_ID =
@@ -175,7 +183,7 @@ export class GoogleAuth<T extends AuthClient = JSONClient> {
175183
defaultScopes?: string | string[];
176184
private keyFilename?: string;
177185
private scopes?: string | string[];
178-
private clientOptions?: AuthClientOptions;
186+
private clientOptions: AuthClientOptions = {};
179187

180188
/**
181189
* The cached universe domain.
@@ -208,7 +216,12 @@ export class GoogleAuth<T extends AuthClient = JSONClient> {
208216
this.keyFilename = opts.keyFilename || opts.keyFile;
209217
this.scopes = opts.scopes;
210218
this.jsonContent = opts.credentials || null;
211-
this.clientOptions = opts.clientOptions;
219+
this.clientOptions = opts.clientOptions || {};
220+
221+
if (opts.universeDomain) {
222+
this.clientOptions.universeDomain = opts.universeDomain;
223+
this.#universeDomain = opts.universeDomain;
224+
}
212225
}
213226

214227
// GAPIC client libraries should always use self-signed JWTs. The following

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {GoogleAuth} from './auth/googleauth';
1515

1616
export * as gcpMetadata from 'gcp-metadata';
1717

18-
export {AuthClient} from './auth/authclient';
18+
export {AuthClient, DEFAULT_UNIVERSE} from './auth/authclient';
1919
export {Compute, ComputeOptions} from './auth/computeclient';
2020
export {
2121
CredentialBody,

test/test.googleauth.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,13 @@ describe('googleauth', () => {
15531553
});
15541554

15551555
describe('getUniverseDomain', () => {
1556+
it('should prefer `universeDomain` > metadata service when available', async () => {
1557+
const universeDomain = 'my.universe.com';
1558+
const auth = new GoogleAuth({universeDomain});
1559+
1560+
assert.equal(await auth.getUniverseDomain(), universeDomain);
1561+
});
1562+
15561563
it('should prefer `clientOptions` > metadata service when available', async () => {
15571564
const universeDomain = 'my.universe.com';
15581565
const auth = new GoogleAuth({clientOptions: {universeDomain}});

0 commit comments

Comments
 (0)