27 HttpServletResponse response,
28 FilterChain filterChain)
throws ServletException, IOException {
30 String authHeader = request.getHeader(
"Authorization");
32 if (authHeader !=
null && authHeader.startsWith(
"Bearer ")) {
33 String token = authHeader.substring(7);
38 List<GrantedAuthority> authorities = List.of(
new SimpleGrantedAuthority(
"ROLE_USER"));
40 UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(
41 email,
null, authorities);
43 authentication.setDetails(
new WebAuthenticationDetailsSource().buildDetails(request));
45 SecurityContextHolder.getContext().setAuthentication(authentication);
49 filterChain.doFilter(request, response);