Search in sources :

Example 1 with MismatchedUserSessionException

use of com.haulmont.cuba.security.global.MismatchedUserSessionException in project cuba by cuba-platform.

the class WebUserSessionSource method checkUiSession.

protected void checkUiSession(UserSession session, AppUI ui) {
    Connection connection = ui.getApp().getConnection();
    UserSession appUserSession = connection.getSession();
    boolean appAuthenticated = connection.isAuthenticated();
    boolean uiAuthenticated = ui.hasAuthenticatedSession();
    if (!appAuthenticated && uiAuthenticated) {
        throw new MismatchedUserSessionException(session.getId());
    }
    if (appAuthenticated && uiAuthenticated && !Objects.equals(appUserSession, session)) {
        throw new MismatchedUserSessionException(session.getId());
    }
}
Also used : UserSession(com.haulmont.cuba.security.global.UserSession) MismatchedUserSessionException(com.haulmont.cuba.security.global.MismatchedUserSessionException) Connection(com.haulmont.cuba.web.Connection)

Aggregations

MismatchedUserSessionException (com.haulmont.cuba.security.global.MismatchedUserSessionException)1 UserSession (com.haulmont.cuba.security.global.UserSession)1 Connection (com.haulmont.cuba.web.Connection)1