Skip to content

Commit

Permalink
Use id-token for oidc Authentication Provider
Browse files Browse the repository at this point in the history
This basically restores the functionality that has been added in kube-rs#70.
Same caveats apply here: auto-refresh of expired id-token is not
supported.
  • Loading branch information
twz123 committed Feb 13, 2021
1 parent 6311728 commit 4821d3c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kube/src/service/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ impl TryFrom<&AuthInfo> for Authentication {
/// https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins
fn try_from(auth_info: &AuthInfo) -> Result<Self, Self::Error> {
if let Some(provider) = &auth_info.auth_provider {
if provider.name == "oidc" {
return match provider.config.get("id-token") {
Some(id_token) => Ok(Authentication::Token(id_token.clone())),
None => Err(ConfigError::AuthExec(
"No id-token for oidc Authentication provider ".into(),
)
.into()),
};
}

match token_from_provider(provider)? {
ProviderToken::GcpCommand(token, Some(expiry)) => {
let mut info = auth_info.clone();
Expand Down

0 comments on commit 4821d3c

Please sign in to comment.