Skip to content

Commit

Permalink
fix: 버그 수정 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
birdieHyun authored Dec 16, 2023
1 parent d32f5a2 commit 9b78ff1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/main/java/yonseigolf/server/config/LoginInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {

System.out.println(request.getRequestURI());

if(request.getMethod().equals("OPTIONS")) {
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/yonseigolf/server/config/OauthInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class OauthInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

System.out.println(request.getRequestURI());

if(request.getMethod().equals("OPTIONS")) {
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/yonseigolf/server/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(defaultInterceptor)
.addPathPatterns("/users/signIn")
.addPathPatterns("/boards/**")
.addPathPatterns("/replies/**")
.addPathPatterns("/users/logout");
.addPathPatterns("/replies/**");

registry.addInterceptor(oauthInterceptor)
.addPathPatterns("/users/signUp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Slf4j
@Controller
public class UserController {

private static final String SESSION_KAKAO_USER = "kakaoUser";
private final UserService userService;
private final OauthLoginService oauthLoginService;
private final KakaoOauthInfo kakaoOauthInfo;
Expand Down Expand Up @@ -72,8 +70,7 @@ public ResponseEntity<CustomResponse<JwtTokenResponse>> signIn(@RequestAttribute

LoggedInUser loggedInUser = userService.signIn(kakaoId);

// 30분 시간 제한
Date date = new Date(new Date().getTime() + 1800000);
Date date = new Date(new Date().getTime() + 3600000);
String tokenReponse = jwtUtil.createToken(loggedInUser, date);

// signIn 할 경우 로그인 진행
Expand Down Expand Up @@ -117,7 +114,7 @@ public ResponseEntity<CustomResponse<JwtTokenResponse>> refreshAccessToken(HttpS
userService.validateRefreshToken(jwtTokenUser.getId(), jwtUtil);

// access token 재발급
String accessToken = userService.generateAccessToken(jwtTokenUser.getId(), jwtUtil, new Date(new Date().getTime() + 1800000));
String accessToken = userService.generateAccessToken(jwtTokenUser.getId(), jwtUtil, new Date(new Date().getTime() + 3600000));

return ResponseEntity
.ok()
Expand Down Expand Up @@ -162,7 +159,6 @@ private String findRefreshToken(HttpServletRequest request) {
}


// TODO: refreshToken 무효화 시키고, 클라이언트에서 access token 폐기
@PostMapping("/users/logout")
public ResponseEntity<CustomResponse<Void>> logOut(@RequestAttribute Long userId, HttpServletResponse response) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public Page<SingleUserResponse> findAllUsers(Pageable pageable, UserClass userCl
.where(user.userClass.eq(userClass))
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(user.semester.asc(), user.name.asc())
.fetchResults();

List<SingleUserResponse> userResponses = results.getResults().stream()
Expand Down

0 comments on commit 9b78ff1

Please sign in to comment.