Skip to content

Commit e033acd

Browse files
fix: fix wrong scopes for self signed jwt (#935)
1 parent d4270ae commit e033acd

File tree

14 files changed

+28
-109
lines changed

14 files changed

+28
-109
lines changed

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class {{ service.name }}Transport(abc.ABC):
111111
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
112112

113113
# Save the scopes.
114-
self._scopes = scopes or self.AUTH_SCOPES
114+
self._scopes = scopes
115115

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

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,11 +1667,7 @@ def test_{{ service.name|snake_case }}_grpc_transport_client_cert_source_for_mtl
16671667
"squid.clam.whelk:443",
16681668
credentials=cred,
16691669
credentials_file=None,
1670-
scopes=(
1671-
{% for scope in service.oauth_scopes %}
1672-
'{{ scope }}',
1673-
{% endfor %}
1674-
),
1670+
scopes=None,
16751671
ssl_credentials=mock_ssl_channel_creds,
16761672
quota_project_id=None,
16771673
options=[
@@ -1784,11 +1780,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_client_cert_s
17841780
"mtls.squid.clam.whelk:443",
17851781
credentials=cred,
17861782
credentials_file=None,
1787-
scopes=(
1788-
{% for scope in service.oauth_scopes %}
1789-
'{{ scope }}',
1790-
{% endfor %}
1791-
),
1783+
scopes=None,
17921784
ssl_credentials=mock_ssl_cred,
17931785
quota_project_id=None,
17941786
options=[
@@ -1829,11 +1821,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_adc(
18291821
"mtls.squid.clam.whelk:443",
18301822
credentials=mock_cred,
18311823
credentials_file=None,
1832-
scopes=(
1833-
{% for scope in service.oauth_scopes %}
1834-
'{{ scope }}',
1835-
{% endfor %}
1836-
),
1824+
scopes=None,
18371825
ssl_credentials=mock_ssl_cred,
18381826
quota_project_id=None,
18391827
options=[

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py

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

103103
# Save the scopes.
104-
self._scopes = scopes or self.AUTH_SCOPES
104+
self._scopes = scopes
105105

106106
# If no credentials are provided, then determine the appropriate
107107
# defaults.

tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,9 +3711,7 @@ def test_asset_service_grpc_transport_client_cert_source_for_mtls(
37113711
"squid.clam.whelk:443",
37123712
credentials=cred,
37133713
credentials_file=None,
3714-
scopes=(
3715-
'https://www.googleapis.com/auth/cloud-platform',
3716-
),
3714+
scopes=None,
37173715
ssl_credentials=mock_ssl_channel_creds,
37183716
quota_project_id=None,
37193717
options=[
@@ -3810,9 +3808,7 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
38103808
"mtls.squid.clam.whelk:443",
38113809
credentials=cred,
38123810
credentials_file=None,
3813-
scopes=(
3814-
'https://www.googleapis.com/auth/cloud-platform',
3815-
),
3811+
scopes=None,
38163812
ssl_credentials=mock_ssl_cred,
38173813
quota_project_id=None,
38183814
options=[
@@ -3853,9 +3849,7 @@ def test_asset_service_transport_channel_mtls_with_adc(
38533849
"mtls.squid.clam.whelk:443",
38543850
credentials=mock_cred,
38553851
credentials_file=None,
3856-
scopes=(
3857-
'https://www.googleapis.com/auth/cloud-platform',
3858-
),
3852+
scopes=None,
38593853
ssl_credentials=mock_ssl_cred,
38603854
quota_project_id=None,
38613855
options=[

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py

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

100100
# Save the scopes.
101-
self._scopes = scopes or self.AUTH_SCOPES
101+
self._scopes = scopes
102102

103103
# If no credentials are provided, then determine the appropriate
104104
# defaults.

tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,9 +1640,7 @@ def test_iam_credentials_grpc_transport_client_cert_source_for_mtls(
16401640
"squid.clam.whelk:443",
16411641
credentials=cred,
16421642
credentials_file=None,
1643-
scopes=(
1644-
'https://www.googleapis.com/auth/cloud-platform',
1645-
),
1643+
scopes=None,
16461644
ssl_credentials=mock_ssl_channel_creds,
16471645
quota_project_id=None,
16481646
options=[
@@ -1739,9 +1737,7 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
17391737
"mtls.squid.clam.whelk:443",
17401738
credentials=cred,
17411739
credentials_file=None,
1742-
scopes=(
1743-
'https://www.googleapis.com/auth/cloud-platform',
1744-
),
1740+
scopes=None,
17451741
ssl_credentials=mock_ssl_cred,
17461742
quota_project_id=None,
17471743
options=[
@@ -1782,9 +1778,7 @@ def test_iam_credentials_transport_channel_mtls_with_adc(
17821778
"mtls.squid.clam.whelk:443",
17831779
credentials=mock_cred,
17841780
credentials_file=None,
1785-
scopes=(
1786-
'https://www.googleapis.com/auth/cloud-platform',
1787-
),
1781+
scopes=None,
17881782
ssl_credentials=mock_ssl_cred,
17891783
quota_project_id=None,
17901784
options=[

tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py

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

104104
# Save the scopes.
105-
self._scopes = scopes or self.AUTH_SCOPES
105+
self._scopes = scopes
106106

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

tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/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.

tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/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.

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6077,12 +6077,7 @@ def test_config_service_v2_grpc_transport_client_cert_source_for_mtls(
60776077
"squid.clam.whelk:443",
60786078
credentials=cred,
60796079
credentials_file=None,
6080-
scopes=(
6081-
'https://www.googleapis.com/auth/cloud-platform',
6082-
'https://www.googleapis.com/auth/cloud-platform.read-only',
6083-
'https://www.googleapis.com/auth/logging.admin',
6084-
'https://www.googleapis.com/auth/logging.read',
6085-
),
6080+
scopes=None,
60866081
ssl_credentials=mock_ssl_channel_creds,
60876082
quota_project_id=None,
60886083
options=[
@@ -6179,12 +6174,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
61796174
"mtls.squid.clam.whelk:443",
61806175
credentials=cred,
61816176
credentials_file=None,
6182-
scopes=(
6183-
'https://www.googleapis.com/auth/cloud-platform',
6184-
'https://www.googleapis.com/auth/cloud-platform.read-only',
6185-
'https://www.googleapis.com/auth/logging.admin',
6186-
'https://www.googleapis.com/auth/logging.read',
6187-
),
6177+
scopes=None,
61886178
ssl_credentials=mock_ssl_cred,
61896179
quota_project_id=None,
61906180
options=[
@@ -6225,12 +6215,7 @@ def test_config_service_v2_transport_channel_mtls_with_adc(
62256215
"mtls.squid.clam.whelk:443",
62266216
credentials=mock_cred,
62276217
credentials_file=None,
6228-
scopes=(
6229-
'https://www.googleapis.com/auth/cloud-platform',
6230-
'https://www.googleapis.com/auth/cloud-platform.read-only',
6231-
'https://www.googleapis.com/auth/logging.admin',
6232-
'https://www.googleapis.com/auth/logging.read',
6233-
),
6218+
scopes=None,
62346219
ssl_credentials=mock_ssl_cred,
62356220
quota_project_id=None,
62366221
options=[

0 commit comments

Comments
 (0)