Skip to content

Commit

Permalink
Merge pull request #10881 from owncloud/fix/idp-logout-issues
Browse files Browse the repository at this point in the history
fix: idp logout issues
  • Loading branch information
kulmann committed May 14, 2024
2 parents 3a52a7f + 58bbdfc commit e373178
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-idp-logout-issues
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: IDP logout issues

Falsely showing the logout page after opening ownCloud Web with an expired token has been fixed.

https://github.com/owncloud/web/pull/10881
10 changes: 3 additions & 7 deletions packages/web-runtime/src/services/auth/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,10 @@ export class AuthService {
})
}
if (isUserContextRequired(this.router, route) || isIdpContextRequired(this.router, route)) {
// defines a number of seconds after a token expired.
// if that threshold surpasses we assume a regular token expiry instead of an auth error.
// as a result, the user will be logged out.
const TOKEN_EXPIRY_THRESHOLD = 5

const user = await this.userManager.getUser()
if (user?.expires_in && user.expires_in < -TOKEN_EXPIRY_THRESHOLD) {
return this.logoutUser()
if (user?.expires_in !== undefined && user.expires_in < 0) {
// token expired, simply return and let the regular auth flow do its thing
return
}

await this.userManager.removeUser('authError')
Expand Down

0 comments on commit e373178

Please sign in to comment.