Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Commit 4623248

Browse files
fix: disable always_use_jwt_access (#348)
* chore: use gapic-generator-python 0.50.3 fix: disable always_use_jwt_access Committer: @busunkim96 PiperOrigin-RevId: 382142900 Source-Link: googleapis/googleapis@513440f Source-Link: googleapis/googleapis-gen@7b1e2c3 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 163c92c commit 4623248

12 files changed

Lines changed: 93 additions & 87 deletions

File tree

google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
113113

114114
# Save the scopes.
115-
self._scopes = scopes or self.AUTH_SCOPES
115+
self._scopes = scopes
116116

117117
# If no credentials are provided, then determine the appropriate
118118
# defaults.

google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def __init__(
6666
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
6767
quota_project_id: Optional[str] = None,
6868
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
69+
always_use_jwt_access: Optional[bool] = False,
6970
) -> None:
7071
"""Instantiate the transport.
7172
@@ -106,6 +107,8 @@ def __init__(
106107
API requests. If ``None``, then default info will be used.
107108
Generally, you only need to set this if you're developing
108109
your own client library.
110+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
111+
be used for service account credentials.
109112
110113
Raises:
111114
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -159,7 +162,7 @@ def __init__(
159162
scopes=scopes,
160163
quota_project_id=quota_project_id,
161164
client_info=client_info,
162-
always_use_jwt_access=True,
165+
always_use_jwt_access=always_use_jwt_access,
163166
)
164167

165168
if not self._grpc_channel:

google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def __init__(
112112
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
113113
quota_project_id=None,
114114
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
115+
always_use_jwt_access: Optional[bool] = False,
115116
) -> None:
116117
"""Instantiate the transport.
117118
@@ -153,6 +154,8 @@ def __init__(
153154
API requests. If ``None``, then default info will be used.
154155
Generally, you only need to set this if you're developing
155156
your own client library.
157+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
158+
be used for service account credentials.
156159
157160
Raises:
158161
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -205,7 +208,7 @@ def __init__(
205208
scopes=scopes,
206209
quota_project_id=quota_project_id,
207210
client_info=client_info,
208-
always_use_jwt_access=True,
211+
always_use_jwt_access=always_use_jwt_access,
209212
)
210213

211214
if not self._grpc_channel:

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
113113

114114
# Save the scopes.
115-
self._scopes = scopes or self.AUTH_SCOPES
115+
self._scopes = scopes
116116

117117
# If no credentials are provided, then determine the appropriate
118118
# defaults.

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def __init__(
6868
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
6969
quota_project_id: Optional[str] = None,
7070
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
71+
always_use_jwt_access: Optional[bool] = False,
7172
) -> None:
7273
"""Instantiate the transport.
7374
@@ -108,6 +109,8 @@ def __init__(
108109
API requests. If ``None``, then default info will be used.
109110
Generally, you only need to set this if you're developing
110111
your own client library.
112+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
113+
be used for service account credentials.
111114
112115
Raises:
113116
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -161,7 +164,7 @@ def __init__(
161164
scopes=scopes,
162165
quota_project_id=quota_project_id,
163166
client_info=client_info,
164-
always_use_jwt_access=True,
167+
always_use_jwt_access=always_use_jwt_access,
165168
)
166169

167170
if not self._grpc_channel:

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc_asyncio.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def __init__(
114114
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
115115
quota_project_id=None,
116116
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
117+
always_use_jwt_access: Optional[bool] = False,
117118
) -> None:
118119
"""Instantiate the transport.
119120
@@ -155,6 +156,8 @@ def __init__(
155156
API requests. If ``None``, then default info will be used.
156157
Generally, you only need to set this if you're developing
157158
your own client library.
159+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
160+
be used for service account credentials.
158161
159162
Raises:
160163
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -207,7 +210,7 @@ def __init__(
207210
scopes=scopes,
208211
quota_project_id=quota_project_id,
209212
client_info=client_info,
210-
always_use_jwt_access=True,
213+
always_use_jwt_access=always_use_jwt_access,
211214
)
212215

213216
if not self._grpc_channel:

google/cloud/bigtable_v2/services/bigtable/transports/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(
103103
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
104104

105105
# Save the scopes.
106-
self._scopes = scopes or self.AUTH_SCOPES
106+
self._scopes = scopes
107107

108108
# If no credentials are provided, then determine the appropriate
109109
# defaults.

google/cloud/bigtable_v2/services/bigtable/transports/grpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(
5858
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
5959
quota_project_id: Optional[str] = None,
6060
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
61+
always_use_jwt_access: Optional[bool] = False,
6162
) -> None:
6263
"""Instantiate the transport.
6364
@@ -98,6 +99,8 @@ def __init__(
9899
API requests. If ``None``, then default info will be used.
99100
Generally, you only need to set this if you're developing
100101
your own client library.
102+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
103+
be used for service account credentials.
101104
102105
Raises:
103106
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -150,7 +153,7 @@ def __init__(
150153
scopes=scopes,
151154
quota_project_id=quota_project_id,
152155
client_info=client_info,
153-
always_use_jwt_access=True,
156+
always_use_jwt_access=always_use_jwt_access,
154157
)
155158

156159
if not self._grpc_channel:

google/cloud/bigtable_v2/services/bigtable/transports/grpc_asyncio.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __init__(
104104
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
105105
quota_project_id=None,
106106
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
107+
always_use_jwt_access: Optional[bool] = False,
107108
) -> None:
108109
"""Instantiate the transport.
109110
@@ -145,6 +146,8 @@ def __init__(
145146
API requests. If ``None``, then default info will be used.
146147
Generally, you only need to set this if you're developing
147148
your own client library.
149+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
150+
be used for service account credentials.
148151
149152
Raises:
150153
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -196,7 +199,7 @@ def __init__(
196199
scopes=scopes,
197200
quota_project_id=quota_project_id,
198201
client_info=client_info,
199-
always_use_jwt_access=True,
202+
always_use_jwt_access=always_use_jwt_access,
200203
)
201204

202205
if not self._grpc_channel:

tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,25 @@ def test_bigtable_instance_admin_client_service_account_always_use_jwt(client_cl
144144
) as use_jwt:
145145
creds = service_account.Credentials(None, None, None)
146146
client = client_class(credentials=creds)
147-
use_jwt.assert_called_with(True)
147+
use_jwt.assert_not_called()
148+
149+
150+
@pytest.mark.parametrize(
151+
"transport_class,transport_name",
152+
[
153+
(transports.BigtableInstanceAdminGrpcTransport, "grpc"),
154+
(transports.BigtableInstanceAdminGrpcAsyncIOTransport, "grpc_asyncio"),
155+
],
156+
)
157+
def test_bigtable_instance_admin_client_service_account_always_use_jwt_true(
158+
transport_class, transport_name
159+
):
160+
with mock.patch.object(
161+
service_account.Credentials, "with_always_use_jwt_access", create=True
162+
) as use_jwt:
163+
creds = service_account.Credentials(None, None, None)
164+
transport = transport_class(credentials=creds, always_use_jwt_access=True)
165+
use_jwt.assert_called_once_with(True)
148166

149167

150168
@pytest.mark.parametrize(
@@ -5150,15 +5168,7 @@ def test_bigtable_instance_admin_grpc_transport_client_cert_source_for_mtls(
51505168
"squid.clam.whelk:443",
51515169
credentials=cred,
51525170
credentials_file=None,
5153-
scopes=(
5154-
"https://www.googleapis.com/auth/bigtable.admin",
5155-
"https://www.googleapis.com/auth/bigtable.admin.cluster",
5156-
"https://www.googleapis.com/auth/bigtable.admin.instance",
5157-
"https://www.googleapis.com/auth/cloud-bigtable.admin",
5158-
"https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
5159-
"https://www.googleapis.com/auth/cloud-platform",
5160-
"https://www.googleapis.com/auth/cloud-platform.read-only",
5161-
),
5171+
scopes=None,
51625172
ssl_credentials=mock_ssl_channel_creds,
51635173
quota_project_id=None,
51645174
options=[
@@ -5267,15 +5277,7 @@ def test_bigtable_instance_admin_transport_channel_mtls_with_client_cert_source(
52675277
"mtls.squid.clam.whelk:443",
52685278
credentials=cred,
52695279
credentials_file=None,
5270-
scopes=(
5271-
"https://www.googleapis.com/auth/bigtable.admin",
5272-
"https://www.googleapis.com/auth/bigtable.admin.cluster",
5273-
"https://www.googleapis.com/auth/bigtable.admin.instance",
5274-
"https://www.googleapis.com/auth/cloud-bigtable.admin",
5275-
"https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
5276-
"https://www.googleapis.com/auth/cloud-platform",
5277-
"https://www.googleapis.com/auth/cloud-platform.read-only",
5278-
),
5280+
scopes=None,
52795281
ssl_credentials=mock_ssl_cred,
52805282
quota_project_id=None,
52815283
options=[
@@ -5322,15 +5324,7 @@ def test_bigtable_instance_admin_transport_channel_mtls_with_adc(transport_class
53225324
"mtls.squid.clam.whelk:443",
53235325
credentials=mock_cred,
53245326
credentials_file=None,
5325-
scopes=(
5326-
"https://www.googleapis.com/auth/bigtable.admin",
5327-
"https://www.googleapis.com/auth/bigtable.admin.cluster",
5328-
"https://www.googleapis.com/auth/bigtable.admin.instance",
5329-
"https://www.googleapis.com/auth/cloud-bigtable.admin",
5330-
"https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
5331-
"https://www.googleapis.com/auth/cloud-platform",
5332-
"https://www.googleapis.com/auth/cloud-platform.read-only",
5333-
),
5327+
scopes=None,
53345328
ssl_credentials=mock_ssl_cred,
53355329
quota_project_id=None,
53365330
options=[

0 commit comments

Comments
 (0)