Skip to content

Commit

Permalink
πŸ› CORS 였λ₯˜ μˆ˜μ •
Browse files Browse the repository at this point in the history
- μ„œλΉ„μŠ€ μ½”λ“œλ₯Ό μˆ˜μ •ν•˜μ˜€μŠ΅λ‹ˆλ‹€.
  • Loading branch information
Ganghee-Lee-0522 committed Jan 12, 2024
1 parent e38a808 commit 68e2855
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.committers.snowflowerthon.committersserver.domain.member.service;

import com.committers.snowflowerthon.committersserver.auth.config.AuthenticationUtils;
import com.committers.snowflowerthon.committersserver.auth.config.CustomAuthenticationToken;
import com.committers.snowflowerthon.committersserver.auth.github.GitHubService;
import com.committers.snowflowerthon.committersserver.common.response.exception.CommitException;
import com.committers.snowflowerthon.committersserver.common.response.exception.ErrorCode;
import com.committers.snowflowerthon.committersserver.common.validation.ValidationService;
import com.committers.snowflowerthon.committersserver.domain.commit.entity.Commit;
import com.committers.snowflowerthon.committersserver.domain.commit.entity.CommitRepository;
Expand All @@ -17,6 +15,8 @@
import com.committers.snowflowerthon.committersserver.domain.univ.entity.UnivRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -26,7 +26,7 @@
@RequiredArgsConstructor
@Service
public class MemberService {
private final AuthenticationUtils authenticationUtils;
// private final AuthenticationUtils authenticationUtils;
private final ValidationService validationService;
private final MemberRepository memberRepository;
private final CommitRepository commitRepository;
Expand All @@ -36,7 +36,11 @@ public class MemberService {

// μ‚¬μš©μž Member λ°›μ•„μ˜€κΈ°
public Member getAuthMember() {
Long memberId = authenticationUtils.getMemberId();

// ν˜„μž¬ μ‚¬μš©μžμ˜ Authentication 객체 κ°€μ Έμ˜€κΈ°
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

Long memberId = Long.valueOf(((CustomAuthenticationToken) authentication).getMemberId());
Member member = validationService.valMember(memberId);
return member;
}
Expand Down

0 comments on commit 68e2855

Please sign in to comment.