Skip to content

Commit

Permalink
chore: 디버깅을 위한 로그를 추가한다.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarltj committed Jul 25, 2024
1 parent 254fb6d commit 524ac81
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
@AllArgsConstructor
public class OAuthUserDataRequest {
private String accessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class OAuthUserInfo {
private String provider;
private String oauthId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<OAuthProvider, OAuthAuthenticationHandler> oAuthAuthenticationHandlers;
Expand All @@ -41,7 +44,7 @@ public OAuthUserDataResponse login(LoginRequest loginRequest) {
loginRequest.getCode(),
loginRequest.getName()
);

log.info("[OAuthService OAuthUserDataRequest] = {}", request);
return oAuthHandler.getOAuthUserData(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
@AllArgsConstructor
public class Tokens {
private final String accessToken;
Expand Down

0 comments on commit 524ac81

Please sign in to comment.