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 issues #10881

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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