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

Added refreshing OIDC ID token as an optional feature #1229

Merged
merged 7 commits into from
Jun 30, 2023

Conversation

Razz4780
Copy link
Contributor

@Razz4780 Razz4780 commented Jun 15, 2023

Solves #1223

Motivation

When OIDC is configured as the authentication method in the kubeconfig, the ID token is never refreshed. This feature is implemented in other tools, e.g. kubectl.

Solution

Added a new feature oidc. When this feature is enabled and the auth provider config contains enough info to enable refreshing, the ID token is refreshed when it's near or past its expiration date.

Implementation requires extra optional dependency on form_urlencoded.

Signed-off-by: Razz4780 <msmolarekg@gmail.com>
@Razz4780 Razz4780 marked this pull request as ready for review June 15, 2023 16:23
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

thank you so much for doing this, this looks great.
have left only some minor comments on it so far, but layout wise it looks very much like what we need for this.

for the million dollar question; does it work? :D
i don't know exactly what we can do to test this (we are not really testing the other oauth flow either), if you have any ideas for it it would be welcome.

kube-client/src/client/auth/mod.rs Outdated Show resolved Hide resolved
kube-client/Cargo.toml Outdated Show resolved Hide resolved
@clux clux added this to the 0.84.0 milestone Jun 15, 2023
@Razz4780
Copy link
Contributor Author

for the million dollar question; does it work? :D i don't know exactly what we can do to test this (we are not really testing the other oauth flow either), if you have any ideas for it it would be welcome.

I'm trying to setup some auth flow to test this manually, but I'm failing :V

@clux clux added the changelog-add changelog added category for prs label Jun 20, 2023
@clux
Copy link
Member

clux commented Jun 23, 2023

I'm trying to setup some auth flow to test this manually, but I'm failing :V

this is a hard one to test. i am okay with getting this released and getting user feedback for now. it does match the state of how things are in oauth (even though of course having tests for it would be better).

Signed-off-by: Razz4780 <msmolarekg@gmail.com>
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #1229 (ea95547) into main (5806a2d) will decrease coverage by 0.97%.
The diff coverage is 53.89%.

❗ Current head ea95547 differs from pull request most recent head 89c40d0. Consider uploading reports for the commit 89c40d0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1229      +/-   ##
==========================================
- Coverage   73.04%   72.08%   -0.97%     
==========================================
  Files          69       71       +2     
  Lines        5525     5714     +189     
==========================================
+ Hits         4036     4119      +83     
- Misses       1489     1595     +106     
Impacted Files Coverage Δ
kube-client/src/client/auth/mod.rs 50.47% <0.00%> (-2.24%) ⬇️
kube-client/src/client/mod.rs 70.76% <ø> (ø)
kube-client/src/client/auth/oidc.rs 56.84% <56.84%> (ø)

... and 1 file with indirect coverage changes

@clux
Copy link
Member

clux commented Jun 26, 2023

NB: Ignore the cargo deny bans issues. Not your fault and this occasionally happens sans-lockfiles. Will be addressed separately.

Signed-off-by: Razz4780 <msmolarekg@gmail.com>
Signed-off-by: Razz4780 <msmolarekg@gmail.com>
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

tests are looking great. just found one minor nit when verifying the documentation for it looked OK. have added a small diff.

kube-client/src/client/auth/mod.rs Outdated Show resolved Hide resolved
Signed-off-by: Razz4780 <msmolarekg@gmail.com>
@clux clux merged commit a6a627c into kube-rs:main Jun 30, 2023
15 checks passed
@clux clux linked an issue Jun 30, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-add changelog added category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement refreshing for OIDC token
2 participants