Hello,
since I have updated vaadin from 24.3.5 to 24.5.0 I get redirected to lumo-css-framework/all-classes.css?continue which does not exist, after login and I need manually change the url. What can be the reason for this. In my secuity config I already added the successUrl, but that has not helped either.
@EnableWebSecurity
@Configuration
public class SecurityConfig extends VaadinWebSecurity {
// Our custom authentication provider
@Autowired
private AppCustomAuthenticationProvider authProvider;
@Override
protected void configure(HttpSecurity http) throws Exception {
// Define public resources, must be before super.configure()
http.authorizeHttpRequests(auth -> {auth
//.requestMatchers(new AntPathRequestMatcher("/admin-only/**")).hasAnyRole("admin")
.requestMatchers(new AntPathRequestMatcher("/VAADIN/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/services/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/rest/**")).permitAll()
// Vaadin public view/resources
.requestMatchers(new AntPathRequestMatcher("/newstool/unregister/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/public/dms/**")).permitAll()
;});
http.formLogin(formLogin ->
formLogin
.defaultSuccessUrl(ApplicationUrl.APP, true) // Redirect after successful login
);
super.configure(http);
// This is important to register your login view to the
// view access checker mechanism:
setLoginView(http, LoginView.class);
}
/**
* Exclude Vaadin-framework communication and static assets from Spring Security
*/
@Override
public void configure(WebSecurity web) throws Exception {
// Configure your static resources with public access here:
web.ignoring().requestMatchers(new AntPathRequestMatcher("/images/**"));
// Delegating the ignoring configuration for Vaadin's
// related static resources to the super class:
super.configure(web);
}
}
This is my VaadinWebSecurity class, has been created for Vaadin 23 but alway updated if necessary.
Spring Security (and VaadinWebSecurity) works so that it tracks what URL the browser is trying to access, it stores that URL and shows a login screen instead. After login, it then redirects you to that URL. So in your case, some part of your app is trying to load lumo-css-framework/all-classes.css which is denied by the security configuration. If this is recorded as the last request before the login request, it is where you will be redirected.
The file was linked in the the css file @import url(‘lumo-css-framework/all-classes.css’); which I already removed. I already have deleted the generated folder in the frontend folder without any change. Teh file does not exists anymore, I get a 404 error when it redirected to it.