mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
PL-9451 Send redirect using VaadinResponse on logout if current UI is null
This commit is contained in:
parent
9764b16ce2
commit
fe533b6467
@ -27,10 +27,7 @@ import com.haulmont.cuba.security.global.LoginException;
|
||||
import com.haulmont.cuba.security.global.UserSession;
|
||||
import com.haulmont.cuba.web.app.loginwindow.AppLoginWindow;
|
||||
import com.haulmont.cuba.web.auth.ExternallyAuthenticatedConnection;
|
||||
import com.vaadin.server.VaadinService;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.WrappedHttpSession;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.server.*;
|
||||
import com.vaadin.ui.UI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -40,6 +37,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -134,6 +132,14 @@ public class DefaultApp extends App implements ConnectionListener, UserSubstitut
|
||||
if (currentUi != null) {
|
||||
currentUi.setContent(null);
|
||||
currentUi.getPage().setLocation(loggedOutUrl);
|
||||
} else {
|
||||
VaadinResponse response = VaadinService.getCurrentResponse();
|
||||
try {
|
||||
((VaadinServletResponse) response).getHttpServletResponse().
|
||||
sendRedirect(loggedOutUrl);
|
||||
} catch (IOException e) {
|
||||
log.error("Error on send redirect to client", e);
|
||||
}
|
||||
}
|
||||
|
||||
VaadinSession vaadinSession = VaadinSession.getCurrent();
|
||||
|
Loading…
Reference in New Issue
Block a user