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: add GOOGLE_API_USE_MTLS support #420

Merged
merged 4 commits into from
May 27, 2020
Merged

feat: add GOOGLE_API_USE_MTLS support #420

merged 4 commits into from
May 27, 2020

Conversation

arithmetic1728
Copy link
Collaborator

@arithmetic1728 arithmetic1728 commented May 20, 2020

Implement the logic in go/python-apiary-mtls, section 2.2 (replaced client_encrypted_cert_source with client_cert_source because microgenerator doesn't use encrypted client key)

For the following logic, part 2 is implemented in Client constructor, part 1 is implemented in GrpcTransport constructor.

# 1. First determines the client cert to use.
client_cert_source_to_use = 
    client_options.client_cert_source or ADC_cert_source or None

# 2. Then determine the api endpoint to use.
if client_options.api_endpoint is not None:
    api_endpoint_to_use = client_options.api_endpoint
else:
    if GOOGLE_API_USE_MTLS == ‘Always’:
        client_options.api_endpoint = mtls_endpoint
    elif GOOGLE_API_USE_MTLS == ‘Never’:
        client_options.api_endpoint = regular_endpoint
    else: 
        if client_cert_source_to_use is None:
            client_options.api_endpoint = regular_endpoint
        else:
            client_options.api_endpoint = mtls_endpoint

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 20, 2020
@arithmetic1728 arithmetic1728 marked this pull request as draft May 20, 2020 21:46
@codecov
Copy link

codecov bot commented May 20, 2020

Codecov Report

Merging #420 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #420   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1451      1451           
  Branches       300       300           
=========================================
  Hits          1451      1451           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4957090...4cd7383. Read the comment docs.

Copy link
Contributor

@software-dov software-dov left a comment

Choose a reason for hiding this comment

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

Looks good, just a few minor comments.

@arithmetic1728 arithmetic1728 marked this pull request as ready for review May 21, 2020 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants