@@ -56,20 +56,16 @@ public String getLoginId(String token) {
5656 return claims .getSubject ();
5757 } catch (SignatureException ex ) {
5858 log .error ("Invalid JWT signature" );
59- throw new RuntimeException ("Invalid JWT signature" , ex );
6059 } catch (MalformedJwtException ex ) {
6160 log .error ("Invalid JWT token" );
62- throw new RuntimeException ("Invalid JWT token" , ex );
6361 } catch (ExpiredJwtException ex ) {
6462 log .error ("Expired JWT token" );
65- throw new RuntimeException ("Expired JWT token" , ex );
6663 } catch (UnsupportedJwtException ex ) {
6764 log .error ("Unsupported JWT token" );
68- throw new RuntimeException ("Unsupported JWT token" , ex );
6965 } catch (IllegalArgumentException ex ) {
7066 log .error ("JWT claims string is empty." );
71- throw new RuntimeException ("JWT claims string is empty." , ex );
7267 }
68+ return null ;
7369 }
7470
7571 public String createAccessToken (String email , Long loginId ) {
@@ -125,7 +121,7 @@ public boolean validateToken(String token) {
125121
126122 /*
127123 accessToken 유효 검사: accessToken이 redis에 있으면 로그아웃 상태임. return false
128- refreshToken 유효 검사: refreshToken이 redis에 있으면 로그인 상태임. return false의 경우 TOKEN_INVALID
124+ refreshToken 유효 검사: refreshToken이 redis에 있으면 로그인 상태임. return false의 경우 INVALID_TOKEN
129125 */
130126 if (redisService .checkExistsValue (token )) {
131127 return false ;
@@ -134,16 +130,16 @@ public boolean validateToken(String token) {
134130 return true ;
135131 } catch (io .jsonwebtoken .security .SecurityException | MalformedJwtException e ) {
136132 log .info ("잘못된 JWT 서명입니다." );
137- throw new RuntimeException ( "잘못된 JWT 서명입니다." , e );
133+ throw new GeneralException ( ErrorStatus . INVALID_SIGNATURE );
138134 } catch (ExpiredJwtException e ) {
139135 log .info ("만료된 JWT 토큰입니다." );
140- throw new RuntimeException ( "만료된 JWT 토큰입니다." , e );
136+ throw new GeneralException ( ErrorStatus . EXPIRED_TOKEN );
141137 } catch (UnsupportedJwtException e ) {
142138 log .info ("지원되지 않는 JWT 토큰입니다." );
143- throw new RuntimeException ( "지원되지 않는 JWT 토큰입니다." , e );
139+ throw new GeneralException ( ErrorStatus . UNSUPPORTED_TOKEN );
144140 } catch (IllegalArgumentException e ) {
145141 log .info ("JWT 토큰이 잘못되었습니다." );
146- throw new RuntimeException ( "JWT 토큰이 잘못되었습니다." , e );
142+ throw new GeneralException ( ErrorStatus . INVALID_TOKEN );
147143 }
148144 }
149145
0 commit comments