Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2018 00:41
Show Gist options
  • Save anonymous/cc759b6e07cb82c072dc258a09c1135a to your computer and use it in GitHub Desktop.
Save anonymous/cc759b6e07cb82c072dc258a09c1135a to your computer and use it in GitHub Desktop.
public class JWTAuthenticationFilter extends GenericFilterBean {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
Authentication authentication = TokenAuthenticationService
.getAuthentication((HttpServletRequest) request);
SecurityContextHolder.getContext().setAuthentication(authentication);
filterChain.doFilter(request, response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment