Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable self signed jwt for http #1000

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
quota_project_id=client_options.quota_project_id,
client_info=client_info,
{% if "grpc" in opts.transport %}
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this is still uner if "grpc" condition, but in tests it always assumes it is always_use_jwt_access=True

{% endif %}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ def test_{{ service.client_name|snake_case }}_client_options(client_class, trans
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
Expand All @@ -227,9 +225,7 @@ def test_{{ service.client_name|snake_case }}_client_options(client_class, trans
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
Expand All @@ -246,9 +242,7 @@ def test_{{ service.client_name|snake_case }}_client_options(client_class, trans
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
Expand All @@ -275,9 +269,7 @@ def test_{{ service.client_name|snake_case }}_client_options(client_class, trans
client_cert_source_for_mtls=None,
quota_project_id="octopus",
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [
Expand Down Expand Up @@ -323,9 +315,7 @@ def test_{{ service.client_name|snake_case }}_mtls_env_auto(client_class, transp
client_cert_source_for_mtls=expected_client_cert_source,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

# Check the case ADC client cert is provided. Whether client cert is used depends on
Expand All @@ -351,9 +341,7 @@ def test_{{ service.client_name|snake_case }}_mtls_env_auto(client_class, transp
client_cert_source_for_mtls=expected_client_cert_source,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

# Check the case client_cert_source and ADC client cert are not provided.
Expand All @@ -370,9 +358,7 @@ def test_{{ service.client_name|snake_case }}_mtls_env_auto(client_class, transp
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)


Expand Down Expand Up @@ -400,9 +386,7 @@ def test_{{ service.client_name|snake_case }}_client_options_scopes(client_class
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)

@pytest.mark.parametrize("client_class,transport_class,transport_name", [
Expand All @@ -429,9 +413,7 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
{% if 'grpc' in opts.transport %}
always_use_jwt_access=True,
{% endif %}
)
{% if 'grpc' in opts.transport %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def export_assets(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def generate_access_token(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def list_buckets(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def delete_log(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def list_log_metrics(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,7 @@ def __init__(self, *,
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
always_use_jwt_access=True,
)

def list_instances(self,
Expand Down