I have this template:
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta property="og:site_name" th:content="#{social.media.title}" />
<meta property="og:url" content=";/>
<meta property="og:type" content="article"/>
<meta property="og:title" th:content="#{social.media.title}" />
<meta property="og:description" th:content="#{social.media.description}" />
<meta property="og:image" content=".png"/>
<!-- Other meta tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" th:content="#{social.media.title}" />
<meta name="twitter:description" th:content="#{social.media.description}" />
<meta name="twitter:image" content=".png">
<!-- Other meta tags -->
<title th:text="#{html.title}">Astrology and Spirituality...</title>
<meta th:content="#{meta.content.description}" content="Explore the realms of astrology and spirituality.." name="description"/>
<meta th:content="#{meta.content.keywords}" content="astrology, spirituality..." name="keywords"/>
<meta content="ie=edge" http-equiv="X-UA-Compatible"/>
<!-- Favicons -->
<link th:href="@{/assets/images/favicon.png}" rel="icon"/>
<link th:href="@{/assets/images/apple-touch-icon.png}" rel="apple-touch-icon"/>
<!-- Google Fonts -->
<link href="+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,600;1,700&family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Raleway:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap"
rel="stylesheet"/>
<link rel="preconnect" href=";/>
<link rel="preconnect" href="; crossorigin=""/>
<link href=":wght@500&display=swap" rel="stylesheet" />
<link href=":wght@300;400&display=swap" rel="stylesheet"/>
<!-- Vendor CSS Files -->
<link th:href="@{/assets/vendor/aos/aos.css}" rel="stylesheet"/>
<link th:href="@{/assets/stylesheets/font-awesome.min.css}" rel="stylesheet"/>
<link th:href="@{/assets/vendor/swiper/swiper-bundle.min.css}" rel="stylesheet"/>
<link th:href="@{/assets/vendor/glightbox/css/glightbox.min.css}" rel="stylesheet"/>
<link th:href="@{/assets/vendor/bootstrap/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/assets/vendor/bootstrap-icons/bootstrap-icons.css}" rel="stylesheet"/>
<!-- Main CSS File -->
<link th:href="@{/assets/stylesheets/styles.css}" rel="stylesheet"/>
<link th:href="@{/assets/stylesheets/custom.css}" rel="stylesheet"/>
<link th:href="@{/assets/stylesheets/responsive.css}" rel="stylesheet"/>
</head>
this config files:
@Profile("web")
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations("classpath:/static/");
}
}
and this:
@Configuration
@EnableWebSecurity
//@EnableMethodSecurity
@Profile("web")
public class WebSecurityConfig {
private final JwtUtils jwtUtils;
private final UserDetailsServiceImpl userDetailsService;
private final AuthEntryPointJwt unauthorizedHandler;
public WebSecurityConfig(JwtUtils jwtUtils,
UserDetailsServiceImpl userDetailsService,
AuthEntryPointJwt unauthorizedHandler) {
this.jwtUtils = jwtUtils;
this.userDetailsService = userDetailsService;
this.unauthorizedHandler = unauthorizedHandler;
}
@Bean
public AuthTokenFilter authenticationJwtTokenFilter() {
return new AuthTokenFilter(jwtUtils, userDetailsService);
}
@Bean
public DaoAuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
authProvider.setUserDetailsService(userDetailsService);
authProvider.setPasswordEncoder(passwordEncoder());
return authProvider;
}
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authConfig) throws Exception {
return authConfig.getAuthenticationManager();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf(AbstractHttpConfigurer::disable)
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.anyRequest().permitAll() //