Skip to content

Commit

Permalink
jwt 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
namyoonhyeok committed Jan 17, 2025
1 parent af1454b commit 9996f5e
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 606 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// Spring Security
implementation 'org.springframework.security:spring-security-crypto'
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.security:spring-security-test'

// JWT Token
// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/example/digger/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ public Map<String, String> login(String email, String password) {
// 리프레시 토큰 저장
refreshTokenStore.put(email, refreshToken);

Map<String, String> tokens = new HashMap<>();
tokens.put("accessToken", accessToken);
tokens.put("refreshToken", refreshToken);

return tokens;
return Map.of("accessToken", accessToken, "refreshToken", refreshToken);
}

public String refreshAccessToken(String email, String refreshToken) {
Expand All @@ -66,6 +62,10 @@ public String refreshAccessToken(String email, String refreshToken) {
throw new RuntimeException("리프레시 토큰이 유효하지 않습니다.");
}

if (!jwtTokenProvider.validateToken(refreshToken)) {
throw new RuntimeException("리프레시 토큰이 만료되었습니다.");
}

// 새 액세스 토큰 발급
return jwtTokenProvider.generateAccessToken(email);
}
Expand Down
109 changes: 0 additions & 109 deletions src/main/resources/static/css/home.css

This file was deleted.

Empty file.
Empty file.
53 changes: 0 additions & 53 deletions src/main/resources/templates/base.html

This file was deleted.

Loading

0 comments on commit 9996f5e

Please sign in to comment.