Skip to content

Commit

Permalink
update auth flow
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 committed Apr 28, 2022
1 parent 038b4f1 commit a51e975
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion google/oauth2/gdch_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,16 @@ def __init__(
self._quota_project_id = quota_project_id

def _make_k8s_token_request(self, request):
k8s_request_body = {
"kind": "TokenRequest",
"apiVersion": "authentication.k8s.io/v1",
"spec": {"audiences": [self._ais_token_endpoint]},
}
# mTLS connection to k8s token endpoint to get a k8s token.
k8s_response_data = _client._token_endpoint_request(
request,
self._k8s_token_endpoint,
{},
k8s_request_body,
None,
True,
http_client.CREATED,
Expand Down
6 changes: 5 additions & 1 deletion tests/oauth2/test_gdch_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ def test__make_k8s_token_request(self, token_endpoint_request):
token_endpoint_request.assert_called_with(
req,
creds._k8s_token_endpoint,
{},
{
"kind": "TokenRequest",
"apiVersion": "authentication.k8s.io/v1",
"spec": {"audiences": [creds._ais_token_endpoint]},
},
None,
True,
http_client.CREATED,
Expand Down

0 comments on commit a51e975

Please sign in to comment.