Replies: 2 comments 3 replies
-
Sounds nice. Do you want to share your preliminary patch? Maybe adding a cmd line flag/config could enable this feature. Did you come across any relevant docs in your research I could read? |
Beta Was this translation helpful? Give feedback.
-
@illume this looks like a problem specific to Azure OIDC because the returned tokens are big and possibly can happen with other OIDC providers. Though this solution does make sense for this case it can affect other OIDC providers,I don't think all OIDC providers return both Access and ID token when we do a token exchange. We should explore what is causing the token to be big and check if limiting the scopes can help reduce the size of the access token or we should see if there is a way to remove the unwanted claims and other information from the token. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I've created a small patch for 0.27.0 which is based on an idea I had to get Headlamp for work with Azure OIDC and AKS clusters.
The idea is to still extract the id-token but also extract the access-token (after doing code exchange) and adding the access-token to the cache with the id-token as the key (as is the case for the refresh-token).
Then, whenever at request is received in the backend, the middleware function will lookup the access-token and replace the Authorization header with this token, before sending it to the Kubernetes API - AKS does not support using id-tokens as access-tokens.
This also works for WSS requests where, obviously, I need to extract the id-token from the wssSecProtocols header rather than the Authorization header.
and it works for my purpose, which is always AKS clusters, but the question is, how to make this more generic and would it be something someone who is more proficient in Headlamp development, be interested in doing this?
(why put it in cache, rather than just returning it to frontend instead of the id-token? Access token tend to be rather large and I ran into issues with browsers not sending the request, and various ingress/L7-LBs not being able to handle 20k+ HTTP headers, so it is better to keep this on the backend). By still sending id-token to frontend, you could extract info if you want to show username and id info stuff in the UI also.)
Beta Was this translation helpful? Give feedback.
All reactions