[프로젝트] 웹 TripRecorder - day06

_bean_·2023년 6월 10일
0
post-thumbnail

오류 및 문제점

1. The signing key's size is 288 bits which is not secure enough for the HS512 algorithm.

  • 문제점: Spring security를 위한 키의 길이가 충분하지 않다.
  • 해결 방안: jwt.secret의 길이를 늘린다.

2. 문자열을 JSON으로 파싱

  • 문제점: 토큰을 받아 정보를 디코딩해 객체로 사용하고자 한다.
  • 해결 방안: json simple 라이브러리를 사용해 문자열을 JSON 객체로 파싱한다.
String jwtstring = request.getHeader("Authorization");
Base64.Decoder decoder = Base64.getUrlDecoder();

String decodeStr = new String(decoder.decode(jwtstring.replace('.', '@').split("@")[1]));
JSONParser parser = new JSONParser();
JSONObject jsonObj = (JSONObject) parser.parse(decodeStr);
System.out.println(jsonObj.get("userId")); 

3. There is no PasswordEncoder mapped for the id "null"

  • 문제점: jwt 토큰을 이용해 로그인 진행 시 null과 mapping된다는 에러가 발생한다.
  • 해결 방안: 회원가입 시 비밀번호를 암호화해 저장해야 한다.

진행상황

1. JWT 회원가입 및 로그인-ing

  • 회원가입 시 비밀번호 암호화
  • payload 데이터 저장 및 디코딩
  • 아직 공부중...

참고 자료

profile
어쩌다 풀스택 :3

0개의 댓글