Hi,
Thank you for reporting the problem, I’ve created a GitHub issue.
As a workaround, create a custom App
implementation
import com.google.common.base.Strings;
import com.vaadin.spring.annotation.VaadinSessionScope;
import io.jmix.core.AccessManager;
import io.jmix.core.security.SecurityContextHelper;
import io.jmix.ui.App;
import io.jmix.ui.AppUI;
import io.jmix.ui.accesscontext.UiShowScreenContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
@Component("demo_App")
@VaadinSessionScope
public class CustomApp extends App {
private static final Logger log = LoggerFactory.getLogger(CustomApp.class);
@Autowired
protected AccessManager accessManager;
@Override
public void loginOnStart() {
initializeUi();
}
@Override
protected String routeTopLevelWindowId() {
if (isAnonymousAuthentication()) {
String screenId = uiProperties.getLoginScreenId();
if (!windowConfig.hasWindow(screenId)) {
screenId = uiProperties.getMainScreenId();
}
String initialScreenId = uiProperties.getInitialScreenId();
if (Strings.isNullOrEmpty(initialScreenId)) {
return screenId;
}
if (!windowConfig.hasWindow(initialScreenId)) {
log.info("Initial screen '{}' is not found", initialScreenId);
return screenId;
}
UiShowScreenContext context = new UiShowScreenContext(initialScreenId);
accessManager.applyRegisteredConstraints(context);
if (!context.isPermitted()) {
log.info("Initial screen '{}' is not permitted", initialScreenId);
return screenId;
}
return initialScreenId;
} else {
return uiProperties.getMainScreenId();
}
}
private void initializeUi() {
AppUI currentUi = AppUI.getCurrent();
if (currentUi != null) {
createTopLevelWindow(currentUi);
}
}
private boolean isAnonymousAuthentication() {
Authentication authentication = SecurityContextHelper.getAuthentication();
return authentication == null ||
authentication instanceof AnonymousAuthenticationToken;
}
}
And register it as a primary, e.g. in your @SpringBootApplication
class:
@SpringBootApplication
public class Sandbox12sApplication {
...
@Bean
@Primary
App app() {
return new CustomApp();
}
}
Regards,
Gleb