Package org.keycloak.services.util
Class BrowserHistoryHelper
java.lang.Object
org.keycloak.services.util.BrowserHistoryHelper
The point of this is to improve experience of browser history (back/forward/refresh buttons), but ensure there is no more redirects then necessary.
Ideally we want to:
- Remove all POST requests from browser history, because browsers don't automatically re-send them when click "back" button. POSTS in history causes unfriendly dialogs and browser "Page is expired" pages.
- Keep the browser URL to match the flow and execution from authentication session. This means that browser refresh works fine and show us the correct form.
- Avoid redirects. This is possible with javascript based approach (JavascriptHistoryReplace). The RedirectAfterPostHelper requires one redirect after POST, but works even on browser without javascript and
on old browsers where "history.replaceState" is unsupported.
- Author:
- Marek Posolda
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.jboss.logging.Logger
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BrowserHistoryHelper
abstract jakarta.ws.rs.core.Response
loadSavedResponse
(KeycloakSession session, AuthenticationSessionModel authSession) abstract jakarta.ws.rs.core.Response
saveResponseAndRedirect
(KeycloakSession session, AuthenticationSessionModel authSession, jakarta.ws.rs.core.Response response, boolean actionRequest, HttpRequest httpRequest) protected boolean
shouldReplaceBrowserHistory
(boolean actionRequest, KeycloakSession session)
-
Field Details
-
SHOULD_UPDATE_BROWSER_HISTORY
- See Also:
-
logger
protected static final org.jboss.logging.Logger logger
-
-
Constructor Details
-
BrowserHistoryHelper
public BrowserHistoryHelper()
-
-
Method Details
-
saveResponseAndRedirect
public abstract jakarta.ws.rs.core.Response saveResponseAndRedirect(KeycloakSession session, AuthenticationSessionModel authSession, jakarta.ws.rs.core.Response response, boolean actionRequest, HttpRequest httpRequest) -
loadSavedResponse
public abstract jakarta.ws.rs.core.Response loadSavedResponse(KeycloakSession session, AuthenticationSessionModel authSession) -
shouldReplaceBrowserHistory
-
getInstance
-