Skip to content

fix(LoginController): Session renewal asks administrators to leave a closed site - #371

Open
Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:fix/renew-admin-closed-site
Open

Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:fix/renew-admin-closed-site

Conversation

@Isaries

@Isaries Isaries commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

When sign-in is disabled, LoginController.renewSession() answers requestLogout to everyone who is signed in. WISEAuthenticationSuccessHandler exempts administrators from a closed site so that the administrator who closed it can still sign in and open it again, but renewal makes no such exemption. A client that acts on requestLogout signs that administrator out at the next renewal after closing the site, and an administrator who is impersonating a student is signed out of their own session too, since signing out ends the whole session.

The WISE-Client fix that makes the client act on requestLogout, WISE-Client#2382, depends on this change: without it, closing the site would sign out the administrator who closed it.

Changes

  • renewSession() answers true to administrators, and to administrators impersonating someone, when sign-in is disabled.
  • New ControllerUtil.isImpersonatingAdministrator(). Researchers can impersonate as well and are also granted ROLE_PREVIOUS_ADMINISTRATOR, so isUserPreviousAdministrator() cannot tell the two apart; the new method reads the role from the original authentication kept in the SwitchUserGrantedAuthority. A researcher impersonating a student is still asked to leave, the same as at sign-in.

Test

  • New RenewSessionTest with five cases: a student, an administrator, an administrator impersonating a student, and a researcher impersonating a student on a closed site, and anyone on an open site. Against the current develop the administrator cases fail with expected: <true> but was: <requestLogout>.
  • RenewSessionTest, LoginControllerTest and WebSecurityConfigAuthorizationTest pass.

…closed site

When sign-in is disabled, renewSession() answers "requestLogout" to
everyone who is signed in, including administrators, while
WISEAuthenticationSuccessHandler lets administrators sign in to a closed
site. A client that acts on the answer would sign out the administrator
who closed the site, and an administrator impersonating a student would
lose their own session. Administrators, and administrators impersonating
someone, now get "true". Researchers can also impersonate and are given
ROLE_PREVIOUS_ADMINISTRATOR as well, so the new
ControllerUtil.isImpersonatingAdministrator() reads the role from the
original authentication rather than checking that authority.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant