Created
January 7, 2018 14:35
-
-
Save slmanju/470e9416a90f09dee2ce206b3dfac809 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AuthenticationTokenFilter extends UsernamePasswordAuthenticationFilter { | |
| @Override | |
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | |
| HttpServletRequest httpRequest = (HttpServletRequest) request; | |
| String authorizationToken = httpRequest.getHeader(HttpHeaders.AUTHORIZATION); | |
| if (authorizationToken != null && authorizationToken.equals("winteriscoming")) { | |
| SecurityContextHolder.getContext() | |
| .setAuthentication(new UsernamePasswordAuthenticationToken("manjula", null, Collections.emptyList())); | |
| } | |
| chain.doFilter(request, response); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment