-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
handlePasswordGrant: insert connectorData into OfflineSession #2199
Conversation
Using dex with the kubernetes oidc client results in the creation of an Offline Session with empty ConnectorData. This change will insert the ConnectorData from the initial Login into the OfflineSession, as already done in `handlePasswordLogin`. Not doing this results in failures to refresh a token. I've observed this with the ldap connetor, other connectors might be affected as well. The ldap connector will fail with this error message: `failed to refresh identity: ldap: failed to unmarshal internal data: unexpected end of JSON input` The `Refresh` method of the ldap connector will first try to unmarshal the ConnectorData, which was empty, as dex wouldn't store it in storage after a successful login. Signed-off-by: Henning Surmeier <[email protected]>
8b06467
to
32904f3
Compare
Hello @hensur. Thanks, it looks good. I wonder if we can write a test for this? |
Hey @nabokihms! |
Signed-off-by: Henning Surmeier <[email protected]>
36310a0
to
3b5e12b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve in advance. Besides the test function name, everything looks good to me.
Signed-off-by: Henning Surmeier <[email protected]>
Thanks for your contribution @hensur ! |
…#2199) * handlePasswordGrant: insert connectorData into OfflineSession This change will insert the ConnectorData from the initial Login into the OfflineSession, as already done in handlePasswordLogin. Signed-off-by: Henning Surmeier <[email protected]> Signed-off-by: cschnapka <[email protected]>
…#2199) * handlePasswordGrant: insert connectorData into OfflineSession This change will insert the ConnectorData from the initial Login into the OfflineSession, as already done in handlePasswordLogin. Signed-off-by: Henning Surmeier <[email protected]>
Overview
Using dex with the kubernetes oidc client results in the creation
of an Offline Session with empty ConnectorData.
This results in a working login, however, the ldap connector will fail once the client attempts to refresh its token.
This change will insert the ConnectorData from the initial Login
into the OfflineSession, as already done in
handlePasswordLogin
.What this PR does / why we need it
Not doing this results in failures to refresh a token.
I've observed this with the ldap connetor, other connectors might
be affected as well.
The ldap connector will fail with this error message:
failed to refresh identity: ldap: failed to unmarshal internal data: unexpected end of JSON input
The
Refresh
method of the ldap connector will first try to unmarshalthe ConnectorData, which was empty, as dex wouldn't
store it in storage after a successful login.
Special notes for your reviewer
While this seems to fix the issue, I'm not sure if it is desired to save the ConnectorData in
handlePasswordGrant
as done inhandlePasswordLogin
.Does this PR introduce a user-facing change?