Skip to content
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

Merged
merged 4 commits into from
Oct 30, 2024
Merged

Fix IdP logout in node #3751

merged 4 commits into from
Oct 30, 2024

Conversation

NSeydoux
Copy link
Contributor

@NSeydoux NSeydoux commented Oct 30, 2024

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.

  • I've added a unit test to test for potential regressions of this bug.
  • The changelog has been updated, if applicable.
  • Commits in this PR are minimal and have descriptive commit messages.

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.
@NSeydoux NSeydoux requested a review from a team as a code owner October 30, 2024 14:59
Copy link
Contributor Author

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

packages/core/src/logout/endSessionUrl.ts Outdated Show resolved Hide resolved
@@ -74,6 +74,7 @@ export default class ClientAuthentication extends ClientAuthenticationBase {

if (loginReturn !== undefined) {
this.fetch = loginReturn.fetch;
this.boundLogout = loginReturn.getLogoutUrl;
Copy link
Contributor Author

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",
Copy link
Contributor Author

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();
Copy link
Contributor Author

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

Comment on lines +226 to +230
getLogoutUrl: maybeBuildRpInitiatedLogout({
idTokenHint: accessInfo.idToken,
endSessionEndpoint:
oidcLoginOptions.issuerConfiguration.endSessionEndpoint,
}),
Copy link
Contributor Author

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.

@NSeydoux NSeydoux merged commit 5915321 into main Oct 30, 2024
34 checks passed
@NSeydoux NSeydoux deleted the fix/SDK-3373/rp-initiated-logout-node branch October 30, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants