Skip to content

Commit

Permalink
fix: fix wrong scopes for self signed jwt (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 authored Jun 28, 2021
1 parent d4270ae commit e033acd
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class {{ service.name }}Transport(abc.ABC):
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1667,11 +1667,7 @@ def test_{{ service.name|snake_case }}_grpc_transport_client_cert_source_for_mtl
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{% endfor %}
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -1784,11 +1780,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_client_cert_s
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{% endfor %}
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -1829,11 +1821,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{% endfor %}
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3711,9 +3711,7 @@ def test_asset_service_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -3810,9 +3808,7 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -3853,9 +3849,7 @@ def test_asset_service_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1640,9 +1640,7 @@ def test_iam_credentials_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -1739,9 +1737,7 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -1782,9 +1778,7 @@ def test_iam_credentials_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6077,12 +6077,7 @@ def test_config_service_v2_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -6179,12 +6174,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -6225,12 +6215,7 @@ def test_config_service_v2_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2204,13 +2204,7 @@ def test_logging_service_v2_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -2307,13 +2301,7 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -2354,13 +2342,7 @@ def test_logging_service_v2_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2069,13 +2069,7 @@ def test_metrics_service_v2_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -2172,13 +2166,7 @@ def test_metrics_service_v2_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -2219,13 +2207,7 @@ def test_metrics_service_v2_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)

# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
self._scopes = scopes

# If no credentials are provided, then determine the appropriate
# defaults.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3020,9 +3020,7 @@ def test_cloud_redis_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -3119,9 +3117,7 @@ def test_cloud_redis_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down Expand Up @@ -3162,9 +3158,7 @@ def test_cloud_redis_transport_channel_mtls_with_adc(
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
Expand Down

0 comments on commit e033acd

Please sign in to comment.