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

OIDC session expires with ID token expiry and refresh token is never used. #1924

Closed
wants to merge 10 commits into from
5 changes: 3 additions & 2 deletions server/auth/types/openid/openid_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class OpenIdAuthentication extends AuthenticationType {
return false;
}

if (cookie.expiryTime > Date.now()) {
if (cookie.credentials.expiryTime > Date.now()) {
return true;
}

Expand All @@ -296,8 +296,9 @@ export class OpenIdAuthentication extends AuthenticationType {
cookie.credentials = {
authHeaderValueExtra: true,
refresh_token: refreshTokenResponse.refreshToken,
expiryTime: getExpirationDate(refreshTokenResponse),
};
cookie.expiryTime = getExpirationDate(refreshTokenResponse);
cookie.expiryTime = Date.now() + this.config.session.ttl;

setExtraAuthStorage(
request,
Expand Down
3 changes: 2 additions & 1 deletion server/auth/types/openid/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@
username: user.username,
credentials: {
authHeaderValueExtra: true,
expiryTime: getExpirationDate(tokenResponse),

Check failure on line 198 in server/auth/types/openid/routes.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (macos-latest)

Delete `··············`

Check failure on line 198 in server/auth/types/openid/routes.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Delete `··············`

Check failure on line 198 in server/auth/types/openid/routes.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (windows-latest)

Delete `··············`
},
authType: AuthType.OPEN_ID,
expiryTime: getExpirationDate(tokenResponse),
expiryTime: Date.now() + this.config.session.ttl,
};
if (this.config.openid?.refresh_tokens && tokenResponse.refreshToken) {
Object.assign(sessionStorage.credentials, {
Expand Down
Loading