스프링 OAuth2 클라이언트 세션 7 : 구글 소셜 로그인 신청
·
Spring Security/OAuth2
구글 GCP(aws와 같이 구글에서 제공하는 클라우드 서비스)https://cloud.google.com/free/?utm_source=google&utm_medium=cpc&utm_campaign=japac-KR-all-en-dr-BKWS-all-core-trial-EXA-dr-1605216&utm_content=text-ad-none-none-DEV_c-CRE_668690472449-ADGP_Hybrid+ https://cloud.google.com/free/?utm_campaign=japac-KR-all-en-dr-BKWS-all-core-trial-EXA-dr-1605216&utm_content=text-ad-none-none-DEV_c-CRE_668690472449-ADGP_Hybrid+&utm..
스프링 OAuth2 클라이언트 세션 6 : 네이버 소셜 로그인 신청
·
Spring Security/OAuth2
네이버 로그인 API 공식 문서https://developers.naver.com/products/login/api/api.md 네이버 로그인 - INTRO환영합니다 네이버 로그인의 올바른 적용방법을 알아볼까요? 네이버 로그인을 통해 신규 회원을 늘리고, 기존 회원은 간편하게 로그인하게 하려면 제대로 적용하는 것이 중요합니다! 이에 올바developers.naver.com네이버 로그인 API 신청네이버 개발자센터 -> 네이버 로그인 APIClientID와 Client Secret를 스프링 부트 application.properties OAuth2 변수에 설정하면 된다.변수 설정application.perperties#registrationspring.security.oauth2.client.registr..
스프링 OAuth2 클라이언트 세션 5 : SecurityConfig 등록
·
Spring Security/OAuth2
SecurityConfigconfig > SecurityConfig@Configuration@EnableWebSecuritypublic class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .csrf((csrf) -> csrf.disable()); http .formLogin((login) -> login.disable()); http .httpBasic((basic) -> basic.disable()); http ..
스프링 OAuth2 클라이언트 세션 4 : OAuth2 변수 역할
·
Spring Security/OAuth2
OAuth2 소셜 로그인을 위한 변수 설정위의 각각의 로직이 동작을 하기 위해서는 서비스별로 특정 값이 필요하기 때문에 변수 설정이 필요하다. application.properties#registrationspring.security.oauth2.client.registration.서비스명.client-name=서비스명spring.security.oauth2.client.registration.서비스명.client-id=서비스에서 발급 받은 아이디spring.security.oauth2.client.registration.서비스명.client-secret=서비스에서 발급 받은 비밀번호spring.security.oauth2.client.registration.서비스명.redirect-uri=서비스에 등록..
스프링 OAuth2 클라이언트 세션 3 : 동작 원리
·
Spring Security/OAuth2
동작 모식도 : OAuth2 코드 방식각각의 필터가 동작하는 주소 (관습)OAuth2AuthorizationRequestRedirectFilter/oauth2/authorization/서비스명/oauth2/authorization/naver/oauth2/authorization/google OAuth2LoginAuthenticationFilter : 외부 인증 서버에 설정할 redirect_uri/login/oauth2/code/서비스명/login/oauth2/code/naver/login/oauth2/code/googleOAuth2 인증 및 동작을 위한 변수들변수 설정만 진행하면 OAuth2AuthorizationRequestRedirectFilter -> OAuth2LoginAuthentication..
스프링 OAuth2 클라이언트 세션 2 : 프로젝트 생성 및 의존성 추가
·
Spring Security/OAuth2
의존성https://start.spring.io/필수 의존성LombokSpring WebMustacheSpring SecurityOAuth2 ClientSpring Data JPAMariaDB Driver데이터베이스 의존성 주석 처리임시로 주석 처리 진행 (스프링 부트에서 데이터베이스 의존성을 추가한 뒤 연결을 진행하지 않을 경우 런타임 에러 발생)기본 컨트롤러 및 VIEW 생성MainControllerimport org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.ResponseBody;@Con..
스프링 OAuth2 클라이언트 세션 1 : 실습 목표 및 간단한 동작 원리
·
Spring Security/OAuth2
실습 목표OAuth2.0 클라이언트와 스프링 시큐리티 6 프레임 워크를 활용하여 신뢰할 수 있는 외부 사이트(구글, 네이버)로 부터 인증을 받고 전달 받은 유저 데이터를 활용하여 세션을 만들고 인가를 진행하는 방법. 인증받은 데이터는 MariaDB를 활용하여 저장하고 관리한다.구현인증 : 네이버 소셜 로그인, 구글 소셜 로그인 (코드 방식)인가 : 세션 방식을 통한 경로별 접근 권한인증 정보 DB 저장 후 추가 정보 기입OAuth2.0 인증 방식 시큐리티 동작 원리인증 서버와 자원 서버 및 우리의 서버 (코드 방식)버전 및 의존성Spring boot 3.4.1Spring Security 6.2.1OAuth2 ClientLombokSpring Data JPA - MariaDBGradle - GroovyIn..