org.keycloak.services.util

## Class BrowserHistoryHelper

- java.lang.Object
- - org.keycloak.services.util.BrowserHistoryHelper

-     public abstract class BrowserHistoryHelper
      extends Object

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.jboss.logging.Logger` | `logger`
    `static String` | `SHOULD_UPDATE_BROWSER_HISTORY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BrowserHistoryHelper()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BrowserHistoryHelper` | `getInstance()`
    `abstract javax.ws.rs.core.Response` | `loadSavedResponse(KeycloakSession session, AuthenticationSessionModel authSession)`
    `abstract javax.ws.rs.core.Response` | `saveResponseAndRedirect(KeycloakSession session, AuthenticationSessionModel authSession, javax.ws.rs.core.Response response, boolean actionRequest, org.jboss.resteasy.spi.HttpRequest httpRequest)`
    `protected boolean` | `shouldReplaceBrowserHistory(boolean actionRequest, org.jboss.resteasy.spi.HttpRequest httpRequest)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SHOULD_UPDATE_BROWSER_HISTORY

          public static final String SHOULD_UPDATE_BROWSER_HISTORY

      See Also:
        Constant Field Values

    - #### logger

          protected static final org.jboss.logging.Logger logger

  - ### Constructor Detail

    - #### BrowserHistoryHelper

          public BrowserHistoryHelper()

  - ### Method Detail

    - #### saveResponseAndRedirect

          public abstract javax.ws.rs.core.Response saveResponseAndRedirect(KeycloakSession session,
                                                                            AuthenticationSessionModel authSession,
                                                                            javax.ws.rs.core.Response response,
                                                                            boolean actionRequest,
                                                                            org.jboss.resteasy.spi.HttpRequest httpRequest)

    - #### loadSavedResponse

          public abstract javax.ws.rs.core.Response loadSavedResponse(KeycloakSession session,
                                                                      AuthenticationSessionModel authSession)

    - #### shouldReplaceBrowserHistory

          protected boolean shouldReplaceBrowserHistory(boolean actionRequest,
                                                        org.jboss.resteasy.spi.HttpRequest httpRequest)

    - #### getInstance

          public static BrowserHistoryHelper getInstance()

Copyright © 2021 JBoss by Red Hat. All rights reserved.