Skip to content

Commit

Permalink
fix: Base64관련 디코딩 코드 변경 -> Base64Url (#173)
Browse files Browse the repository at this point in the history
* fix: Base64관련 디코딩 코드 변경 -> Base64Url

* refactor: 쿠폰 스케쥴 업데이트 및 config 수정

* style: 문자열 checkstyle 수정
  • Loading branch information
parksey authored Nov 29, 2023
1 parent 25932fb commit 33fd2a8
Show file tree
Hide file tree
Showing 6 changed files with 2,314 additions and 606 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.moabam.api.application.auth;

import java.util.Base64;
import java.nio.charset.StandardCharsets;

import org.json.JSONObject;
import org.springframework.stereotype.Service;
Expand All @@ -13,6 +13,7 @@

import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.io.Decoders;
import lombok.RequiredArgsConstructor;

@Service
Expand All @@ -37,8 +38,9 @@ public boolean isTokenExpire(String token) {

public PublicClaim parseClaim(String token) {
String claims = token.split("\\.")[1];
String decodeClaims = new String(Base64.getDecoder().decode(claims));
JSONObject jsonObject = new JSONObject(decodeClaims);
byte[] claimsBytes = Decoders.BASE64URL.decode(claims);
String decodedClaims = new String(claimsBytes, StandardCharsets.UTF_8);
JSONObject jsonObject = new JSONObject(decodedClaims);

return AuthorizationMapper.toPublicClaim(jsonObject);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config
Loading

0 comments on commit 33fd2a8

Please sign in to comment.