GitHub

https://github.com/Backcoder-June

BackCoder 기록 그리고 숙달

Spring Security 3

[Spring Security] Authentication Failure Handler 적용

Spring Security 에서는 로그인 성공 / 실패시, SecurityConfig 에서 특정 URL 로 리다이렉트 시키거나 Handler 를 활용해 후처리를 해줄 수 있습니다. [ SecurityConfig ] .defaultSuccessUrl("/allboard") @Autowired AuthenticationFailureHandler authenticationFailureHandler; .failureHandler(authenticationFailureHandler) Handler 를 이용하고자 하면 (1) AuthenticationFailureHandler 인터페이스를 implements 해서 사용하거나 (2) SimpleUrlAuthenticationFailureHandler 를 extend..

Back to the Spring 2022.12.24

[ Spring Security ] OAuth2 구글 / 네이버 로그인

너무나 다양하고 많은 웹 / 앱 서비스들이 출시되고 있는 추세에 매번 새로운 Application 에, 새로운 정보로 가입하는 건 요즘은 꽤나 기피됩니다. OAuth2 를 활용하면 대중적인 사이트들의 로그인 API 를 활용해서 나의 새로운 Application에 손쉽게 클릭 한 두번으로 가입할 수 있게 됩니다. 최근 출시하는 Application 들은 이러한 편의성을 강점으로 살리고자 로그인 방법만 10가지가 넘게 제공하기도 하죠.. 대표적인 사이트 구글, 네이버 로그인을 OAuth 를 활용해 적용하는 법을 정리해 보았습니다. 1. 라이브러리 설치 [ Build Gradle ] # Spring Scurity implementation 'org.springframework.boot:spring-boot-s..

Back to the Spring 2022.12.23

[Spring Security] SecurityConfig, UserDetailsService, BCrypt, CSRF

1. Spring Security : Application 의 보안( Authentication, Authroization )을 담당하는 스프링 하위 프레임워크 - Authentication ( 인증 ) : 해당 사용자의 로그인 정보가 일치하는 지 확인 ( ID / PW ) - Authorization ( 권한 ) : '인증' 된 사용자가 요청한 페이지에 접근 가능한지 권한을 확인하고 부여 [ SecurityConfig ] : 시큐리티의 Authentication / Authorization 기능을 설정 (1) old 버전 @Configuration @EnableWebSecurity public class SecurityConfig (extends WebSecurityConfigurerAdapter) {..

Back to the Spring 2022.12.23