Skip to content

Commit

Permalink
apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
Basaeng committed Sep 12, 2023
1 parent 99d8ea6 commit fc75c2e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/lpvs/auth/OAuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@RequiredArgsConstructor
public class OAuthService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> {

private final LPVSMemberRepository LPVSMemberRepository;
private final LPVSMemberRepository lpvsMemberRepository;

@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
Expand Down Expand Up @@ -56,7 +56,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic

}

private Map customAttribute(Map attributes, String userNameAttributeName, MemberProfile memberProfile, String registrationId) {
private Map<String, Object> customAttribute(Map<String, Object> attributes, String userNameAttributeName, MemberProfile memberProfile, String registrationId) {
Map<String, Object> customAttribute = new LinkedHashMap<>();
customAttribute.put(userNameAttributeName, attributes.get(userNameAttributeName));
customAttribute.put("provider", registrationId);
Expand All @@ -68,11 +68,11 @@ private Map customAttribute(Map attributes, String userNameAttributeName, Member

private LPVSMember saveOrUpdate(MemberProfile memberProfile) {

LPVSMember LPVSMember = LPVSMemberRepository.findByEmailAndProvider(memberProfile.getEmail(), memberProfile.getProvider())
LPVSMember lpvsMember = lpvsMemberRepository.findByEmailAndProvider(memberProfile.getEmail(), memberProfile.getProvider())
.map(m -> m.update(memberProfile.getName(), memberProfile.getEmail()))
.orElse(memberProfile.toMember());

return LPVSMemberRepository.save(LPVSMember);
return lpvsMemberRepository.save(lpvsMember);
}

}
1 change: 0 additions & 1 deletion src/main/java/com/lpvs/controller/LPVSWebController.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Slf4j
public class LPVSWebController {
private LPVSMemberRepository memberRepository;
private LPVSDetectedLicenseRepository detectedLicenseRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/lpvs/exception/PageControllerAdvice.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class PageControllerAdvice {

@ExceptionHandler(LoginFailedException.class)
public ResponseEntity<ErrorResponse> loginFailedHandle(LoginFailedException e) {
log.info("loginFailed");
log.error("loginFailed" + e.getMessage());
errorResponse = new ErrorResponse(e.getMessage(), HttpStatus.UNAUTHORIZED.name(), HttpStatus.UNAUTHORIZED.value());
return new ResponseEntity<>(errorResponse, HttpStatus.UNAUTHORIZED);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/lpvs/service/LPVSLoginCheckService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public Boolean oauthLoginStatus(Authentication authentication) {
if (oAuth2User == null) {
return Boolean.FALSE;
}
Map<String, Object> attributes = oAuth2User.getAttributes();
return Boolean.TRUE;
} catch (NullPointerException e) {
return Boolean.FALSE;
Expand Down

0 comments on commit fc75c2e

Please sign in to comment.