Skip to content

Commit

Permalink
chore: testing logout with session kill
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzem committed Jun 10, 2024
1 parent f6fad06 commit 8c7a76e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/api/auth/federated-logout/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export async function GET() {
try {
const issuerLogout = `${process.env.KEYCLOAK_ISSUER}/protocol/openid-connect/logout`
const redirectToSessionLogout = new URLSearchParams({
logout: 'true',
client_id: process.env.KEYCLOAK_ID ?? '',
post_logout_redirect_uri: rootUrl ? `${rootUrl}/logout` : '',
redirect_uri: rootUrl ? `${rootUrl}/logout` : '',
Expand Down
4 changes: 2 additions & 2 deletions tests/api/federated-logout.api.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ describe('GET api/federated-logout', () => {
// Then
await expect(promise).rejects.toEqual(
new Error(
'NEXT REDIRECT KEYCLOAK_ISSUER/protocol/openid-connect/logout?client_id=&post_logout_redirect_uri=NEXTAUTH_URL%2Flogout&redirect_uri=NEXTAUTH_URL%2Flogout'
'NEXT REDIRECT KEYCLOAK_ISSUER/protocol/openid-connect/logout?logout=true&client_id=&post_logout_redirect_uri=NEXTAUTH_URL%2Flogout&redirect_uri=NEXTAUTH_URL%2Flogout'
)
)
expect(redirect).toHaveBeenCalledWith(
'KEYCLOAK_ISSUER/protocol/openid-connect/logout?client_id=&post_logout_redirect_uri=NEXTAUTH_URL%2Flogout&redirect_uri=NEXTAUTH_URL%2Flogout'
'KEYCLOAK_ISSUER/protocol/openid-connect/logout?logout=true&client_id=&post_logout_redirect_uri=NEXTAUTH_URL%2Flogout&redirect_uri=NEXTAUTH_URL%2Flogout'
)
})
})

0 comments on commit 8c7a76e

Please sign in to comment.