cloudfoundry / cf-crd-explorations

Apache License 2.0
3 stars 2 forks source link

Spike: implement OIDC token refreshing in the `cf` CLI #37

Closed gcapizzi closed 3 years ago

gcapizzi commented 3 years ago

Background

Refresh tokens are a way for OAuth2/OIDC clients to stay authenticated after their access/ID token has expired by exchanging a separate refresh token for a new access/ID token. cf already does this with UAA. In absence of token refreshing, the user needs to login again every time their token expires.

After #33 we know that we want to implement refresh tokens, as:

More details in OAuth 2.0 Simplified.

Deliverables

A fork of cf that can refresh OIDC tokens obtained using the oidc-login plugin.

Dev Notes

We know that, in order to get a refresh token from an OIDC provider, the offline_access scope needs to be requested. Unfortunately not all providers implement it, so we'll need to use the scopes_supported OIDC Discovery claim, which in turn is not supported by all providers 😓 . The Dex example-app handles this here.

gcapizzi commented 3 years ago

We are shifting our approach to supporting $KUBECONFIG instead. We still need to figure out token refreshing as part of supporting the OIDC auth-provider, so we'll carry on there.