Skip to content

Commit b2eab77

Browse files
committed
fix: provide both universeDomain and endpoint
1 parent d8a3cab commit b2eab77

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

googleapis_auth/lib/src/iam_signer.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,19 @@ class IAMSigner {
5757
/// [serviceAccountEmail] is the optional service account email to use for
5858
/// signing. If not provided, it will be fetched from the GCE metadata server.
5959
///
60-
/// [endpoint] specifies the IAM Credentials API endpoint.
61-
/// Defaults to `https://iamcredentials.googleapis.com`.
60+
/// [universeDomain] specifies the universe domain for constructing the IAM
61+
/// endpoint. Defaults to [defaultUniverseDomain] (googleapis.com).
62+
///
63+
/// [endpoint] specifies a custom IAM Credentials API endpoint URL.
64+
/// If provided, takes precedence over [universeDomain].
6265
IAMSigner(
6366
http.Client client, {
6467
String? serviceAccountEmail,
65-
String endpoint = 'https://iamcredentials.$defaultUniverseDomain',
68+
String? endpoint,
69+
String universeDomain = defaultUniverseDomain,
6670
}) : _client = client,
6771
_serviceAccountEmail = serviceAccountEmail,
68-
_endpoint = endpoint;
72+
_endpoint = endpoint ?? 'https://iamcredentials.$universeDomain';
6973

7074
/// Returns the service account email.
7175
///

googleapis_auth/lib/src/impersonated_auth_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ImpersonatedAuthClient extends AutoRefreshDelegatingClient {
128128
null,
129129
targetScopes,
130130
),
131-
super(sourceClient as http.Client, closeUnderlyingClient: false);
131+
super(sourceClient, closeUnderlyingClient: false);
132132

133133
/// The email of the target service account being impersonated.
134134
String get targetServiceAccount => _targetServiceAccount;
@@ -201,7 +201,7 @@ class ImpersonatedAuthClient extends AutoRefreshDelegatingClient {
201201
final signer = IAMSigner(
202202
_sourceClient,
203203
serviceAccountEmail: _targetServiceAccount,
204-
endpoint: _universeDomain,
204+
universeDomain: _universeDomain,
205205
);
206206
return signer.sign(data);
207207
}

0 commit comments

Comments
 (0)