Closed gorbunkov closed 1 day ago
Jmix version: 2.3.0
If the server.servlet.context-path is set, then Logout button redirects to the root URL ("/").
server.servlet.context-path
See forum.
server.servlet.context-path=/demo
The application redirects to the http://localhost:8080 instead of http://localhost:8080/demo
The login view is displayed.
The workaround is to define the extended Flowui security configuration in the project:
import com.google.common.base.Strings; import io.jmix.flowui.view.View; import io.jmix.securityflowui.security.FlowuiVaadinWebSecurity; import jakarta.servlet.ServletContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.stereotype.Component; @Component public class ExtFlowuiVaadinWebSecurity extends FlowuiVaadinWebSecurity { private static final Logger log = LoggerFactory.getLogger(ExtFlowuiVaadinWebSecurity.class); private ServletContext servletContext; @Autowired protected void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } @Override protected void initLoginView(HttpSecurity http) throws Exception { String loginViewId = uiProperties.getLoginViewId(); if (Strings.isNullOrEmpty(loginViewId)) { log.debug("Login view Id is not defined"); return; } Class<? extends View<?>> controllerClass = viewRegistry.getViewInfo(loginViewId).getControllerClass(); String contextPath = servletContext.getContextPath(); if (!contextPath.startsWith("/")) contextPath = "/" + contextPath; setLoginView(http, controllerClass, contextPath); } }
Tested on Jmix version: 2.3.999-SNAPSHOT Jmix Studio plugin version: 2.3.SNAPSHOT6530-241 IntelliJ version: IntelliJ IDEA 2024.1.1
Environment
Jmix version: 2.3.0
Bug Description
If the
server.servlet.context-path
is set, then Logout button redirects to the root URL ("/").See forum.
Steps To Reproduce
Current Behavior
The application redirects to the http://localhost:8080 instead of http://localhost:8080/demo
Expected Behavior
The login view is displayed.
Workaround
The workaround is to define the extended Flowui security configuration in the project: