Search in sources :

Example 6 with Connection

use of com.haulmont.cuba.web.Connection in project cuba by cuba-platform.

the class IdpLoginLifecycleManager method pingIdpSession.

@Order(Events.HIGHEST_PLATFORM_PRECEDENCE + 10)
@EventListener
protected void pingIdpSession(SessionHeartbeatEvent event) {
    Connection connection = event.getSource().getConnection();
    if (webIdpConfig.getIdpEnabled() && connection.isAuthenticated()) {
        UserSession session = connection.getSessionNN();
        String idpSessionId = session.getAttribute(IdpService.IDP_USER_SESSION_ATTRIBUTE);
        if (idpSessionId != null) {
            idpSessionPingConnector.pingIdpSessionServer(idpSessionId);
        }
    }
}
Also used : UserSession(com.haulmont.cuba.security.global.UserSession) Connection(com.haulmont.cuba.web.Connection) Order(org.springframework.core.annotation.Order) EventListener(org.springframework.context.event.EventListener)

Example 7 with Connection

use of com.haulmont.cuba.web.Connection in project cuba by cuba-platform.

the class ExceptionDialog method forceLogout.

protected void forceLogout() {
    App app = AppUI.getCurrent().getApp();
    final WebWindowManager wm = app.getWindowManager();
    try {
        Connection connection = wm.getApp().getConnection();
        if (connection.isConnected()) {
            connection.logout();
        }
    } catch (Exception e) {
        log.warn("Exception on forced logout", e);
    } finally {
        // always restart UI
        String url = ControllerUtils.getLocationWithoutParams() + "?restartApp";
        Page.getCurrent().open(url, "_self");
    }
}
Also used : App(com.haulmont.cuba.web.App) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) Connection(com.haulmont.cuba.web.Connection) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException)

Example 8 with Connection

use of com.haulmont.cuba.web.Connection in project cuba by cuba-platform.

the class DefaultApp method createConnection.

@Override
protected Connection createConnection() {
    Connection connection = super.createConnection();
    connection.addStateChangeListener(this);
    return connection;
}
Also used : Connection(com.haulmont.cuba.web.Connection)

Aggregations

Connection (com.haulmont.cuba.web.Connection)8 App (com.haulmont.cuba.web.App)3 EventListener (org.springframework.context.event.EventListener)3 Order (org.springframework.core.annotation.Order)3 UserSession (com.haulmont.cuba.security.global.UserSession)2 WebWindowManager (com.haulmont.cuba.web.WebWindowManager)2 Locale (java.util.Locale)2 SecurityContext (com.haulmont.cuba.core.sys.SecurityContext)1 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)1 Window (com.haulmont.cuba.gui.components.Window)1 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)1 User (com.haulmont.cuba.security.entity.User)1 IdpSession (com.haulmont.cuba.security.global.IdpSession)1 LoginException (com.haulmont.cuba.security.global.LoginException)1 AnonymousUserCredentials (com.haulmont.cuba.web.security.AnonymousUserCredentials)1 ExternalUserCredentials (com.haulmont.cuba.web.security.ExternalUserCredentials)1 VaadinRequest (com.vaadin.server.VaadinRequest)1 Principal (java.security.Principal)1