-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
토큰 재발급을 위함
- Loading branch information
Showing
2 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
24 changes: 20 additions & 4 deletions
24
src/main/java/org/capstone/maru/controller/AuthController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
package org.capstone.maru.controller; | ||
|
||
import jakarta.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.RequiredArgsConstructor; | ||
import org.capstone.maru.security.token.RefreshTokenService; | ||
import org.capstone.maru.security.token.TokenDto; | ||
import org.capstone.maru.security.token.TokenReIssuer; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping | ||
public class LoginController { | ||
public class AuthController { | ||
|
||
private final RefreshTokenService refreshTokenService; | ||
private final TokenReIssuer tokenReIssuer; | ||
|
||
@PostMapping("/token/refresh") | ||
public ResponseEntity<TokenDto> refreshToken(HttpServletRequest request) { | ||
TokenDto newAccessToken = tokenReIssuer.reissueAccessToken(request); | ||
|
||
return ResponseEntity.ok(newAccessToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters