Repository navigation
Description
Description
After a login with OpenID Connect, closing the browser (all windows, browser process ended) and reopening it does not end the session: MapStore still shows the user as logged in, and the next token refresh restores the session without asking for credentials, as long as the IdP session is valid.
This also happens when the refresh_token cookie of GeoStore is a session cookie (geosolutions-it/geostore#606, fixed by geosolutions-it/geostore#609 with refreshTokenCookieMaxAge=-1), because MapStore persists the security state, including the access token, in localStorage (mapstore.persistence.security), which survives the browser restart. On a shared computer, the next person who opens the browser can use the application with the previous user's identity, if that user closed the browser without logging out.
As suggested in geosolutions-it/geostore#606, we are opening the issue here.
Proposal: a configuration option in localConfig.json (for example in the security section) to choose where the security state is persisted:
localStorage: current behavior, default;- browser session:
sessionStorageor another session-scoped mechanism shared by the tabs of the same browser session (for example a session cookie used as a marker), so that the state is discarded after a browser restart; - no persistence of the token.
When the state is discarded, MapStore should also end the session on the server side (GeoStore and, where configured, the IdP), so that the next refresh cannot restore it.
What kind of improvement you want to add?
- Minor changes to existing features
Other useful information
Environment: MapStore 2026.03.00 (GeoStore 2.7.0); OpenID Connect login with Keycloak 26 (keycloakOAuth2Config), confidential client with PKCE; access token 5 minutes, SSO session idle 30 minutes, SSO session max 8 hours.
Steps to reproduce:
- Use a browser profile that does not restore the previous session at startup and does not keep running in background.
- Log in to MapStore with an OpenID Connect provider (Keycloak).
- Close the browser completely, without logging out.
- Reopen the browser and open MapStore: the user is still logged in.
- Wait for the next
refreshTokencall: it succeeds and the session goes on (with a sessionrefresh_tokencookie, the cookie is set again).
Private (incognito) windows are not a good test case, because the browser clears all storage when they are closed.
Current workaround: in our project we are adding an epic that sets a session cookie as a "browser session" marker after the login. When the page loads with a persisted login but without the marker, it performs a full logout (MapStore and the IdP) and shows a notice. We would be happy to drop it in favor of a standard option.
Related: geosolutions-it/geostore#606, geosolutions-it/geostore#609.
Activity
danabit commentedon Nov 18, 2026
Additional finding: when the token refresh fails,
refreshAccessTokendispatcheslogout(null), which only clears the local state.DELETE /session/logoutis sent only byonLogout(the Logout button), so the GeoStore and IdP sessions are not ended. With geosolutions-it/geostore#613 GeoStore can now end the IdP session even with an expired access token, so it would help if MapStore called the server logout in this case too.afabiani commentedon Nov 18, 2026
#13171 covers both points, for 2026.03.01 (it is marked for backport to 2026.03.xx):
localConfig.jsonoption,loginPersistence:local(the default, as today) orbrowserSession. WithbrowserSession, a session cookie marks the browser session at login. A stored login without it is not restored after a browser restart: MapStore starts logged out and sendsDELETE /session/logoutwith the stored access token. The login is still shared by the tabs and survives page reloads. Logins made before the option is turned on end at their next page load.DELETE /session/logoutwith the token it held, whatever the setting.With GeoStore 2.7.1 (geosolutions-it/geostore#611 and geosolutions-it/geostore#613) and
globalLogoutEnabled=true, that logout also ends the Keycloak session, even when the access token has already expired. I tested it in Chromium against Keycloak 26, simulating a browser restart: withbrowserSessionthe Keycloak session ends, and with the default setting a failed refresh after the restart now ends it as well. Browsers set to restore the previous session at startup also restore session cookies, so with them the login is kept.This should let you drop your marker epic once you are on these versions; unlike it, MapStore does not show a notice. If you can try #13171 in your project, let me know how it goes.
afabiani commentedon Nov 18, 2026
One more thing about the refresh, which matters with very short access tokens. GeoStore refuses a refresh once the access token has expired (403), and it renews the token only in the last part of its lifetime:
refreshTokenLifetimeFractionis 0.8 by default, so the last 20%. MapStore asks for a refresh every 30 seconds (tokenRefreshInterval).With your 5-minute tokens that window is 60 seconds, so MapStore always catches it. With tokens shorter than about two and a half minutes it can miss it, and the session ends at the first expiry; in my tests with 60-second tokens it did. That was already the case before, but with #13171 such a failure also ends the Keycloak session, so the user is asked for credentials again instead of being logged in silently. If you ever shorten the token lifetime, lower
tokenRefreshIntervalinlocalConfig.jsonoroidcOAuth2Config.refreshTokenLifetimeFractioningeostore-ovr.propertiesto match.2 remaining items
afabiani commentedon Nov 18, 2026
Added to #13171: MapStore now dispatches
SESSION_ENDED(web/client/actions/security.js) withreasonset tobrowserSessionwhen a stored login of an earlier browser session is not restored, orrefreshFailedwhen the token refresh fails;SESSION_END_REASONSholds both values. The first is dispatched on the first location change after startup, so an epic in your project's plugins receives it. The Logout button does not dispatch it.I checked the three cases in the browser: a restart with
browserSessiongivesSESSION_ENDEDwithbrowserSessionand noLOGOUT, a failed refresh givesLOGOUTfollowed bySESSION_ENDEDwithrefreshFailed, and the Logout button givesLOGOUTonly.danabit commentedon Nov 18, 2026
Thanks a lot,
SESSION_ENDEDwith the reason is exactly what we needed: with 2026.03.01 we will keep only our notice, based on that action, and drop the rest of our code. We will test it when the release is out.#13166 Server logout on refused refresh only with browserSession