diff --git a/src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/TokenResponse.java b/src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/LoginResponse.java similarity index 51% rename from src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/TokenResponse.java rename to src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/LoginResponse.java index 3ae29d6..33b5d20 100644 --- a/src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/TokenResponse.java +++ b/src/main/java/com/sanbosillok/sanbosillokserver/api/auth/dto/LoginResponse.java @@ -1,13 +1,14 @@ package com.sanbosillok.sanbosillokserver.api.auth.dto; import lombok.Data; -import lombok.RequiredArgsConstructor; @Data -public class TokenResponse { +public class LoginResponse { private String accessToken; + private String role; - public TokenResponse(String accessToken) { + public LoginResponse(String accessToken, String role) { this.accessToken = accessToken; + this.role = role; } } diff --git a/src/main/java/com/sanbosillok/sanbosillokserver/config/jwt/LoginFilter.java b/src/main/java/com/sanbosillok/sanbosillokserver/config/jwt/LoginFilter.java index 6063620..5cb8d38 100644 --- a/src/main/java/com/sanbosillok/sanbosillokserver/config/jwt/LoginFilter.java +++ b/src/main/java/com/sanbosillok/sanbosillokserver/config/jwt/LoginFilter.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.sanbosillok.sanbosillokserver.api.auth.dto.CustomUserDetails; -import com.sanbosillok.sanbosillokserver.api.auth.dto.TokenResponse; +import com.sanbosillok.sanbosillokserver.api.auth.dto.LoginResponse; import jakarta.servlet.FilterChain; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -57,7 +57,7 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR String token = jwtTokenProvider.createJwt(username, role); response.setContentType("application/json"); - response.getWriter().print(objectMapper.writeValueAsString(new TokenResponse(token))); + response.getWriter().print(objectMapper.writeValueAsString(new LoginResponse(token, role))); } @Override