Closed gcapizzi closed 3 years ago
So far we have managed to implement 2 oidc flows
We have tested both against dex (instructions here)
Both flows are supported by the same cf cli plugin based on whether you pass in a client secret or not.
We wanted to test the implicit grant flow as well, but it looks like it is not supported by kubernetes, since when you configure the apiserver to work with oidc, the oidc-client-id is a required parameter: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#configuring-the-api-server
We wanted to test the implicit grant flow as well, but it looks like it is not supported by kubernetes
@georgethebeatle the Implicit flow still requires client_id
ID to be passed in the authorization request.
We implemented the implicit flow for the cli plugin which had a few caveats:
id_token
responseTypes
configurationnonce
parameter (which is some random string data) and then verify it in the response token [1]. We do not do this as part of this spike as it seemed trivialTo solve the last problem, we serve a static HTML page with some javascript to extract the token and send it as a query param to the server.
References:
As a conclusion - we think that the PKCE flow is the best one and the most suited to use in the cli. However we can also have all of the other flows implemented in the plugin for whoever needs them, and have PKCE as default.
It is recommended for IDPs to issue short-lived tokens with refresh tokens for better security. This gives the IDP the opportunity to stop access for a given user, effectively revoking the token. Okta suggests a short lived token might be issued for several hours. It also points out the bad user experience using short-lived tokens without refresh tokens, while noting long-lived tokens are problematic for security.
The expiry time of a token is up to configuration in the IDP, i.e. outside of our control. Therefore we should definitely support refresh tokens to avoid a bad user experience when IDP configuration provides short-lived tokens.
If we want to support the implicit flow, tokens will need to be longer-lived, and we should document the potential security issues with harder revocation and more damage on leakage.
Background
OpenID Connect 1.0, which is built on top of OAuth 2.0, supports three authentication flows:
We want to understand which one is the best suited for our
oidc-login
implementation. Some notes:client_id
and aclient_secret
), and the browser never gets to see the token. Unfortunately, this is only beneficial to server-side apps ("confidential clients") that can securely store the client credentials. Client-side apps ("public clients") can't, so this flow ends up being pretty much as secure as the Implicit one.Questions
oidc-login
with Authorization Code + PKCE?Resources
Dev Notes
golang.org/x/oauth2
.