-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix: security
- Loading branch information
Showing
6 changed files
with
37 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/java/kr/hs/dgsw/SOPO_server_v2/domain/auth/dto/res/TokenRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
src/main/java/kr/hs/dgsw/SOPO_server_v2/global/infra/security/MemberDetailsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
package kr.hs.dgsw.SOPO_server_v2.global.infra.security; | ||
|
||
import kr.hs.dgsw.SOPO_server_v2.domain.auth.dto.res.TokenRes; | ||
import kr.hs.dgsw.SOPO_server_v2.domain.member.entity.MemberEntity; | ||
import kr.hs.dgsw.SOPO_server_v2.domain.member.repository.MemberRepository; | ||
import kr.hs.dgsw.SOPO_server_v2.global.infra.jwt.JwtProvider; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.core.userdetails.UserDetailsService; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class MemberDetailsService implements UserDetailsService { | ||
public class MemberDetailsService { | ||
|
||
private final MemberRepository memberRepository; | ||
private final JwtProvider jwtProvider; | ||
|
||
public UserDetails loadUserByUsername(String id) { | ||
public TokenRes loadUserByUsername(String id) { | ||
MemberEntity memberEntity = memberRepository.findByMemberId(id); | ||
return CustomMemberDetails.of(memberEntity); | ||
return jwtProvider.generateToken(id, memberEntity.getMemberState()); | ||
} | ||
} |