Skip to content

Commit

Permalink
getClamis() -> getClaims() 오타 신경써주세요
Browse files Browse the repository at this point in the history
  • Loading branch information
jun-ha committed Aug 17, 2024
1 parent 08abfe2 commit c255ea3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/java/newCar/event_page/jwt/JwtTokenProviderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import newCar.event_page.config.JwtConfig;
import newCar.event_page.model.enums.Team;
import newCar.event_page.model.entity.User;
import newCar.event_page.repository.jpa.UserLightRepository;
import newCar.event_page.repository.jpa.UserRepository;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -71,7 +70,7 @@ public String generateToken(Map<String, Object> claims){
public String generateTokenWithTeam(Team team, String authorizationHeader){

Long userId;
userId = getClamis(authorizationHeader).get("userId",Long.class);
userId = getClaims(authorizationHeader).get("userId",Long.class);

Map<String, Object> claims = new HashMap<>();

Expand All @@ -84,19 +83,19 @@ public String generateTokenWithTeam(Team team, String authorizationHeader){
@Override
public Long getUserId(String token){
Long userId;
userId = getClamis(token).get("userId",Long.class);
userId = getClaims(token).get("userId",Long.class);
return userId;
} //토큰에서 유저 Id를 추출

@Override
public Team getTeam(String token){
return claimsToTeam(getClamis(token).get("team",String.class));
return claimsToTeam(getClaims(token).get("team",String.class));
} //토큰에서 유저 Team을 추출

@Override
public boolean validateToken(String token){
try{
getClamis(token);
getClaims(token);
return true;
} catch (ExpiredJwtException | SignatureException e){
return false;
Expand All @@ -108,7 +107,7 @@ public boolean validateToken(String token){
public boolean validateAdminToken(String token){
String role = "";
try{
role = getClamis(token).get("role",String.class);
role = getClaims(token).get("role",String.class);
} catch (ExpiredJwtException | SignatureException e){
return false;
} //토큰이 만료되었거나 변조되었다면
Expand All @@ -128,7 +127,7 @@ private Team claimsToTeam(String team){
}
}

private Claims getClamis(String token){
private Claims getClaims(String token){
return Jwts.parserBuilder()
.setSigningKey(secretKey())
.build()
Expand Down

0 comments on commit c255ea3

Please sign in to comment.