Skip to content

Commit 89acb32

Browse files
committed
🔥 refactor: Admin, User 코드 리팩토링
1 parent 7174f8e commit 89acb32

File tree

14 files changed

+15
-16
lines changed

14 files changed

+15
-16
lines changed

backend/src/main/java/io/f1/backend/domain/admin/app/AdminDetailService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundEx
2727
() ->
2828
new UsernameNotFoundException(
2929
AdminErrorCode.ADMIN_NOT_FOUND.getMessage()));
30-
// 프론트엔드로 내려가지 않는 예외
3130
return new AdminPrincipal(admin);
3231
}
3332
}

backend/src/main/java/io/f1/backend/domain/admin/app/handler/AdminLoginFailureHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void onAuthenticationFailure(
2828
HttpServletResponse response,
2929
AuthenticationException exception)
3030
throws IOException {
31-
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); // 401
31+
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
3232
response.setContentType("application/json;charset=UTF-8");
3333

3434
AdminLoginFailResponse errorResponse =

backend/src/main/java/io/f1/backend/domain/admin/app/handler/AdminLoginSuccessHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.f1.backend.domain.admin.app.handler;
22

33
import static io.f1.backend.domain.user.constants.SessionKeys.ADMIN;
4-
import static io.f1.backend.global.util.SecurityUtils.getCurrentAdminPrincipal;
4+
import static io.f1.backend.global.security.util.SecurityUtils.getCurrentAdminPrincipal;
55

66
import io.f1.backend.domain.admin.dao.AdminRepository;
77
import io.f1.backend.domain.admin.dto.AdminPrincipal;
@@ -44,6 +44,6 @@ public void onAuthenticationSuccess(
4444
adminRepository.save(admin);
4545
httpSession.setAttribute(ADMIN, principal.getAuthenticationAdmin());
4646

47-
response.setStatus(HttpServletResponse.SC_OK); // 200
47+
response.setStatus(HttpServletResponse.SC_OK);
4848
}
4949
}

backend/src/main/java/io/f1/backend/domain/auth/api/AuthController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.f1.backend.domain.auth.api;
22

3-
import static io.f1.backend.global.util.SecurityUtils.getAuthentication;
3+
import static io.f1.backend.global.security.util.SecurityUtils.getAuthentication;
44

55
import io.f1.backend.domain.admin.dto.AdminPrincipal;
66
import io.f1.backend.domain.auth.dto.CurrentUserAndAdminResponse;

backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import static io.f1.backend.domain.game.mapper.RoomMapper.toRoomSettingResponse;
1111
import static io.f1.backend.domain.game.websocket.WebSocketUtils.getDestination;
1212
import static io.f1.backend.domain.quiz.mapper.QuizMapper.toGameStartResponse;
13-
import static io.f1.backend.global.util.SecurityUtils.getCurrentUserId;
14-
import static io.f1.backend.global.util.SecurityUtils.getCurrentUserNickname;
13+
import static io.f1.backend.global.security.util.SecurityUtils.getCurrentUserId;
14+
import static io.f1.backend.global.security.util.SecurityUtils.getCurrentUserNickname;
1515

1616
import io.f1.backend.domain.game.dto.MessageType;
1717
import io.f1.backend.domain.game.dto.RoomEventType;

backend/src/main/java/io/f1/backend/domain/quiz/app/QuizService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import io.f1.backend.global.exception.errorcode.QuizErrorCode;
2525
import io.f1.backend.global.exception.errorcode.UserErrorCode;
2626
import io.f1.backend.global.security.enums.Role;
27-
import io.f1.backend.global.util.SecurityUtils;
27+
import io.f1.backend.global.security.util.SecurityUtils;
2828

2929
import lombok.RequiredArgsConstructor;
3030
import lombok.extern.slf4j.Slf4j;

backend/src/main/java/io/f1/backend/domain/user/api/UserController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.f1.backend.domain.user.api;
22

3-
import static io.f1.backend.global.util.SecurityUtils.logout;
3+
import static io.f1.backend.global.security.util.SecurityUtils.logout;
44

55
import io.f1.backend.domain.user.app.UserService;
66
import io.f1.backend.domain.user.dto.MyPageInfo;

backend/src/main/java/io/f1/backend/domain/user/app/UserService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import io.f1.backend.global.exception.errorcode.AuthErrorCode;
2020
import io.f1.backend.global.exception.errorcode.UserErrorCode;
2121
import io.f1.backend.global.util.RedisPublisher;
22-
import io.f1.backend.global.util.SecurityUtils;
22+
import io.f1.backend.global.security.util.SecurityUtils;
2323

2424
import jakarta.servlet.http.HttpSession;
2525

backend/src/main/java/io/f1/backend/domain/user/app/handler/CustomAuthenticationEntryPoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void commence(
3030
AuthenticationException authException)
3131
throws IOException {
3232
response.setContentType("application/json;charset=UTF-8");
33-
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); // 401
33+
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
3434

3535
Map<String, String> errorResponse = new HashMap<>();
3636
errorResponse.put("code", AuthErrorCode.UNAUTHORIZED.getCode());

backend/src/main/java/io/f1/backend/domain/user/app/handler/UserAndAdminLogoutSuccessHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public void onLogoutSuccess(
1515
HttpServletRequest request,
1616
HttpServletResponse response,
1717
Authentication authentication) {
18-
response.setStatus(HttpServletResponse.SC_NO_CONTENT); // 204
18+
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
1919
}
2020
}

0 commit comments

Comments
 (0)