diff --git a/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java b/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java index 885d6f7..853d06d 100644 --- a/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java +++ b/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java @@ -10,10 +10,13 @@ import com.moneymong.global.security.token.dto.Tokens; import com.moneymong.global.security.token.service.TokenService; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service +@Slf4j @RequiredArgsConstructor public class UserFacadeService { private final UserService userService; @@ -25,12 +28,17 @@ public class UserFacadeService { public LoginSuccessResponse login(LoginRequest loginRequest) { OAuthUserDataResponse oAuthUserData = oAuthService.login(loginRequest); + log.info("Token = {}", loginRequest.getAccessToken()); + log.info("Code = {}", loginRequest.getCode()); + OAuthUserInfo oAuthUserInfo = OAuthUserInfo.from(oAuthUserData); + log.info("OAuthUserInfo = {}", oAuthUserInfo); AuthUserInfo registerResult = userService.getOrRegister(oAuthUserInfo); Tokens tokens = tokenService.createTokens(registerResult); + log.info("TOKENS = {}", tokens); boolean loginSuccess = true; boolean schoolInfoExists = userUniversityService.exists(registerResult.getUserId()); diff --git a/src/main/java/com/moneymong/global/config/security/SecurityConfig.java b/src/main/java/com/moneymong/global/config/security/SecurityConfig.java index 9c22ac3..759a99a 100644 --- a/src/main/java/com/moneymong/global/config/security/SecurityConfig.java +++ b/src/main/java/com/moneymong/global/config/security/SecurityConfig.java @@ -37,6 +37,7 @@ public SecurityFilterChain httpSecurity(HttpSecurity http) throws Exception { auth.requestMatchers("/api/v1/users").permitAll(); auth.requestMatchers("/api/v1/tokens").permitAll(); auth.requestMatchers("/actuator/**").permitAll(); + auth.anyRequest().authenticated(); }) .exceptionHandling(handler -> handler.authenticationEntryPoint(jwtAuthenticationEntryPoint)) .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) diff --git a/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserDataRequest.java b/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserDataRequest.java index e9265e6..0cca58b 100644 --- a/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserDataRequest.java +++ b/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserDataRequest.java @@ -2,8 +2,10 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.ToString; @Getter +@ToString @AllArgsConstructor public class OAuthUserDataRequest { private String accessToken; diff --git a/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserInfo.java b/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserInfo.java index 7468856..10c6352 100644 --- a/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserInfo.java +++ b/src/main/java/com/moneymong/global/security/oauth/dto/OAuthUserInfo.java @@ -6,6 +6,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor +@ToString public class OAuthUserInfo { private String provider; private String oauthId; diff --git a/src/main/java/com/moneymong/global/security/service/OAuthService.java b/src/main/java/com/moneymong/global/security/service/OAuthService.java index 11a0cf5..691231c 100644 --- a/src/main/java/com/moneymong/global/security/service/OAuthService.java +++ b/src/main/java/com/moneymong/global/security/service/OAuthService.java @@ -18,7 +18,10 @@ import static com.moneymong.global.exception.enums.ErrorCode.USER_NOT_FOUND; +import lombok.extern.slf4j.Slf4j; + @Service +@Slf4j public class OAuthService { private final Map oAuthAuthenticationHandlers; @@ -41,7 +44,7 @@ public OAuthUserDataResponse login(LoginRequest loginRequest) { loginRequest.getCode(), loginRequest.getName() ); - + log.info("[OAuthService OAuthUserDataRequest] = {}", request); return oAuthHandler.getOAuthUserData(request); } diff --git a/src/main/java/com/moneymong/global/security/token/dto/Tokens.java b/src/main/java/com/moneymong/global/security/token/dto/Tokens.java index 23ddc0b..b34cade 100644 --- a/src/main/java/com/moneymong/global/security/token/dto/Tokens.java +++ b/src/main/java/com/moneymong/global/security/token/dto/Tokens.java @@ -2,8 +2,10 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.ToString; @Getter +@ToString @AllArgsConstructor public class Tokens { private final String accessToken;