-
Notifications
You must be signed in to change notification settings - Fork 182
Conversation
To pass tests, you need a PR in the main repo with only adding dependency (not updating /base submodule). |
look like there is only formatting issues with test: https://travis-ci.org/kubernetes-client/python-base/jobs/270071663 Sorry that I didn't spend time on this yet because of the rush of PRs before kubernetes code freeze. I will do a proper review very soon. |
220d3d7
to
2c8cb0f
Compare
2c8cb0f
to
c246d19
Compare
Codecov Report
@@ Coverage Diff @@
## master #31 +/- ##
==========================================
- Coverage 93.93% 91.65% -2.28%
==========================================
Files 11 11
Lines 824 875 +51
==========================================
+ Hits 774 802 +28
- Misses 50 73 +23
Continue to review full report at Codecov.
|
Thanks @mbohlool Ill write some unit tests this week or next (time depending). |
any update on this? also did you test this? e.g. is there a |
@mbohlool sorry I have been down with the cold.. I have tested this with CoreOS Tectonic which uses OIDC for authentication. I can probably just write unit tests to begin with before integration tests. |
@dmyerscough no worries. Integration tests are not required for this PR to be merged, but if you are up to add it, go for it. But unit tests are more important. Thanks for doing this. |
93e75c9
to
6ff4cb7
Compare
c245524
to
e62a87a
Compare
941a691
to
b67735c
Compare
@@ -58,6 +60,63 @@ def _raise_exception(st): | |||
# token for me:pass | |||
TEST_BASIC_TOKEN = "Basic bWU6cGFzcw==" | |||
|
|||
TEST_OIDC_LOGIN = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should use the actual login keys in test. Can you mock it and use something like "test_login..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can mock this out; I noticed due to the mocking the code coverage test fails.
@dmyerscough friendly ping. Any updates? |
@dmyerscough you may want to look at this comment kubernetes-client/python#368 (comment) |
@mbohlool I have been pretty busy and haven't had time to look at this. |
refresh = request.refresh_token( | ||
token_url=response['token_endpoint'], | ||
refresh_token=provider['config']['refresh-token'], | ||
verify=ca_cert.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using auth
here can remove all the use of cert staff above:
refresh = request.refresh_token(
token_url=response['token_endpoint'],
refresh_token=provider['config']['refresh-token'],
auth=(provider['config']['client-id'], provider['config']['client-secret']))
) | ||
else: | ||
jwt_attributes = json.loads( | ||
base64.b64decode(parts[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error in my test:
TypeError: Incorrect padding
Would be nice to handle this error here.
Hi @dmyerscough , @mbohlool: Thanks |
@ltamaster you are more than welcome to take over this, I have been swamped with a new job and preparing for a new born. |
@ltamaster I am fine with a new PR. |
Hi @dmyerscough, |
@dmyerscough @mbohlool forgot my last message, I found my problem |
hi @dmyerscough
|
I apologize in advance if this is already supported, but from looking at the PR, I think there needs to be a way to refresh the token not only at configuration initialization time but also during invocation of the K8 API calls. The token might expire right before a call thus causing the call to fail with an authentication failure. This will be needed for services that run a long time and rely on being able to reach the K8 Api Server (also short services that happen to be unlucky). I think this can be done with a check to 'exp' field in the id-token right before a call_api or catch a 401 return status and perform a refresh token operation and update the configuration object with the new id_token and refresh_token values from the OAuth server. |
Please ref #48 |
No description provided.