@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException,
ServletException {
if (!"POST".equalsIgnoreCase(request.getMethod())) {
throw new InsufficientAuthenticationException("Invalid HTTP Method. it accepts only POST ");
}
if (!isContentTypeValid(request)) {
throw new InsufficientAuthenticationException("Invalid content type. It accepts JSON only.");
}
final LoginRequest loginRequest = getLoginRequest(request);
System.err.println("attemptAuthentication");
final UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(loginRequest.getUsername(), loginRequest.getPassword());
// Allow subclasses to set the "details" property
// setDetails(request, authRequest);
return getAuthenticationManager().authenticate(authRequest);
}
JSONPayloadAuthenticationFilter.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:interview-preparation
作者:
评论列表
文章目录