Skip to content

Commit

Permalink
Never log in to logout page (#1173)
Browse files Browse the repository at this point in the history
* never log in to logout page

* format
  • Loading branch information
theosanderson committed Feb 29, 2024
1 parent 1b34aa7 commit 6489601
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions website/src/middleware/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { type BaseClient, Issuer, type TokenSet } from 'openid-client';

import { getConfiguredOrganisms, getRuntimeConfig } from '../config.ts';
import { getInstanceLogger } from '../logger.ts';
import { routes } from '../routes';
import { shouldMiddlewareEnforceLogin } from '../utils/shouldMiddlewareEnforceLogin.ts';

export const ACCESS_TOKEN_COOKIE = 'access_token';
Expand Down Expand Up @@ -47,6 +48,10 @@ export async function getKeycloakClient() {
}

export const getAuthUrl = async (redirectUrl: string) => {
const logout = routes.logout();
if (redirectUrl.endsWith(logout)) {
redirectUrl = redirectUrl.replace(logout, routes.userOverviewPage());
}
const authUrl = (await getKeycloakClient()).authorizationUrl({
redirect_uri: redirectUrl,
scope: 'openid',
Expand Down

0 comments on commit 6489601

Please sign in to comment.