-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix IdP logout in node #3751
Fix IdP logout in node #3751
Conversation
The IdP logout no longer fails in Node if the session was restored from storage (using `getSessionFromStorage`), which is the typical use case of how the session should be retrieved.
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.
This helped testing the RP-initiated logout locally
@@ -74,6 +74,7 @@ export default class ClientAuthentication extends ClientAuthenticationBase { | |||
|
|||
if (loginReturn !== undefined) { | |||
this.fetch = loginReturn.fetch; | |||
this.boundLogout = loginReturn.getLogoutUrl; |
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.
The logout needs to be bound on a successful login, because that's the context in which the tokens are available (because of our scope-based security approach).
@@ -38,6 +38,7 @@ export const standardOidcOptions: IOidcOptions = { | |||
claimsSupported: [], | |||
scopesSupported: ["openid"], | |||
grantTypesSupported: ["authorization_code"], | |||
endSessionEndpoint: "https://example.com/end-session", |
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.
This is for the test mock
@@ -181,6 +181,7 @@ describe("RefreshTokenOidcHandler", () => { | |||
}), | |||
)) as SolidClientAuthnCore.LoginResult; | |||
expect(result).toBeDefined(); | |||
expect(result?.getLogoutUrl).toBeDefined(); |
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.
This tests the non-regression
getLogoutUrl: maybeBuildRpInitiatedLogout({ | ||
idTokenHint: accessInfo.idToken, | ||
endSessionEndpoint: | ||
oidcLoginOptions.issuerConfiguration.endSessionEndpoint, | ||
}), |
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.
This ensures the ID token is bound to the logout URL when doing the refresh token flow.
The IdP logout no longer fails in Node if the session was restored from storage (using
getSessionFromStorage
), which is the typical use case of how the session should be retrieved.