Projects/Problem & Solution
-
Sneakers Mania - 카카오 로그인(2)Projects/Problem & Solution 2021. 12. 27. 17:55
카카오 로그인 환경설정 ㆍ 카카오 개발자 홈페이지에 접속을 한 후 로그인을 한다. 로그인이 완료되면 위 사진에 표시된 내 애플리케이션에 접속한다. ㆍ 애플리케이션 추가하기 버튼을 누른다. ㆍ 앱 이름과 사업자명을 입력하고 저장 버튼을 클릭한다. ㆍ 왼쪽 메뉴바에서 요약 정보 메뉴를 선택한 후 생성된 REST API 키를 확인하고 따로 저장한다. ㆍ 왼쪽 메뉴바에서 플랫폼 메뉴를 선택한 후 Web 사이트 도메인을 추가해준다. ㆍ 왼쪽 메뉴바에서 카카오 로그인 메뉴를 선택한 후 카카오 로그인을 활성화시켜준다. ㆍ 카카오 로그인을 활성화시킨 후 하단에 개발자가 사용할 Redirect URI를 설정한다. ㆍ 마지막으로, 왼쪽 메뉴바에서 동의 항목 메뉴를 선택한 후 개발자가 요청할 사용자의 개인정보를 설정한다. ..
-
Sneakers Mania - 카카오 로그인(1)Projects/Problem & Solution 2021. 12. 27. 14:54
OAuth란? OAuth의 개념 OAuth는 Open Authorization의 약자이다. OAuth는 인터넷 사용자들이 비밀번호를 제공하지 않고 다른 웹사이트 상의 자신들의 정보에 대해 웹사이트나 애플리케이션의 접근 권한을 부여할 수 있는 공통적인 수단으로 사용된다. 즉, 애플리케이션의 사용자 비밀번호를 제3자에게 제공하지 않으면서 인증 및 권한 부여를 관리해주는 오픈형 프로토콜이다. 예를 들어서, 쇼핑몰과 같은 사이트에 접속할 때 네이버나 카카오로 로그인을 할 수 있는 것처럼 별도의 정보 제공 없이 로그인을 제공하는 플랫폼의 아이디만 있으면 서비스를 이용할 수 있게 해주는 것이 바로 OAuth이다. OAuth 2.0의 탄생 웹이 성장하면서 많은 사이트들이 분산 서비스에 의존하게 되고, third-pa..
-
Delivery Together - JWT 인증방식의 로그인(4)Projects/Problem & Solution 2021. 12. 26. 20:33
개요 이전 게시물에서 사용자 로그인 정보를 통해 JWT를 발급하는 과정까지 알아보았다. 이번에는 발급한 JWT를 통해 어떠한 방식으로 정보 교류가 이루어지는지 알아보도록 하겠다. JWT 인증 JwtAuthenticationFilter 클래스 public class JwtAuthenticationFilter extends OncePerRequestFilter { private UserDetailsService userDetailsService; private JwtTokenHelper jwtTokenHelper; public JwtAuthenticationFilter(UserDetailsService userDetailsService, JwtTokenHelper jwtTokenHelper) { this.u..
-
Delivery Together - JWT 인증방식의 로그인(3)Projects/Problem & Solution 2021. 12. 25. 21:59
개요 지금까지는 JWT의 사용 이유와 JWT의 특징을 알아보았고, 이어서 Spring Security 내에서 어떠한 절차로 인증 과정이 처리되는지 알아보았다. 이번에는 사용자가 입력한 로그인 정보를 통해 JWT를 생성해서 발급하는 과정까지 코드로 구현해보겠다. 사전 설정 1. 의존성 추가 implementation 'io.jsonwebtoken:jjwt:0.9.1' ㆍ JWT 생성을 위한 외부 라이브러리인 jjwt에 대한 의존성을 build.gradle에 추가한다. 2. JwtTokenHelper 클래스 생성 @Component public class JwtTokenHelper { private SignatureAlgorithm SIGNATURE_ALGORITHM = SignatureAlgorithm.H..
-
Delivery Together - JWT 인증방식의 로그인(2)Projects/Problem & Solution 2021. 12. 24. 15:16
사용자 정보 생성 User 클래스 생성 @Data public class User implements UserDetails { private String username; // 사용자 계정 private String birthdate; // 사용자 생일 private String country; // 사용자 국적 private String gender; // 사용자 성별 private String password; // 사용자 비밀번호 private String role; // 사용자 권한 @Override public Collection
-
Delivery Together - JWT 인증방식의 로그인(1)Projects/Problem & Solution 2021. 12. 23. 23:50
JWT의 사용 이유 HTTP 프로토콜의 문제점 REST API가 있고 권한이 있는 사용자에게만 액세스를 제한하려고 한다는 상황을 가정해 보겠다. 가장 단순한 접근 방식은 API가 사용자 이름과 비밀번호를 요청하는 것이다. 그리고 해당 정보가 실제로 존재하는지를 데이터베이스에서 검색해 인증을 확인한다. 마지막으로 인증된 사용자에게 해당 요청을 수행할 권한이 있는지 확인한다. 두 검사 모두 통과하면 실제 API가 실행되는 것이다. 하지만 문제점이 있다. HTTP 프로토콜은 Stateless로 동작한다. 위 그림과 같이 새 요청(GET/order/42)은 이전 요청에 대해 아무것도 알지 못하기 때문에 새 요청마다 다시 인증을 해야 하는 절차가 추가된다. 즉, 새로운 요청이 있을 때마다 리소스가 소모된다는 뜻이..