spring-security
rest login & ajax login
張's blog
2020. 7. 19. 20:16
https://zzangjava.tistory.com/m/1077
- session control
https://www.baeldung.com/spring-security-session
- rest login (authenticationManager이용, controller에서 처리)https://cusonar.tistory.com/17
/* form login disable할 때 로그인 처리 컨트롤러 예제 */
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping(value="/login/authenticate")
public Authentication authenticate(HttpServletRequest request, HttpSession session) {
String username = request.getParameter("user_id");
String password = request.getParameter("password");
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
token.setDetails(request);
Authentication authentication = authenticationManager.authenticate(token);
SecurityContextHolder.getContext().setAuthentication(authentication);
session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
return authentication;
}
- rest login (Filter 이용)
https://johnmarc.tistory.com/74
- ajax login
https://jungeunlee95.github.io/java/2019/07/18/8-Spring-Security-ajax-%EB%A1%9C%EA%B7%B8%EC%9D%B8%ED%9B%84-json%EC%9D%91%EB%8B%B5%EB%B0%9B%EA%B8%B0/
https://programmer93.tistory.com/m/42
https://www.baeldung.com/spring-security-two-login-pages
- csrf ajax 전송
https://hyunsangwon93.tistory.com/m/28