Hello! Due to architectural constraints, I decided to write my custom jwt authentication without using VaadinWebSecurity, setLoginView; making it using cookies. But for some reason I get a blank page when trying to open the login page and opening the console in the browser I see “Failed to load resource: the server responded with a status of 403 ()”
My SecurityConfig:
@Bean
@Order(4)
public SecurityFilterChain vaadinSecurityFilterChain(HttpSecurity http) throws Exception {
http
.securityMatcher("/backoffice/**")
.authorizeHttpRequests(auth -> auth
// These routes are available to everyone
.requestMatchers("/backoffice/login")
.permitAll()
// Access for administrators
.requestMatchers("/backoffice/**")
.hasAnyAuthority(RoleName.ROLE_ADMIN.name())
.anyRequest().authenticated())
.formLogin(formLogin -> formLogin
.loginPage("/backoffice/login").permitAll()
.defaultSuccessUrl("/backoffice", true))
.logout(formLogout -> formLogout
.logoutUrl("/backoffice/logout")
.logoutSuccessUrl("/backoffice/login"))
.csrf(AbstractHttpConfigurer::disable)
// Adding jwt filter
.addFilterBefore(jwtVaadinAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
// Turn off the session
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
return http.build();
}
Could it be the influence of the api setting with the authentication jwt that is on top?
How could this be fixed? please tell me.
Thanks for the help.