Skip to content

Commit

Permalink
refactor: Modify MemberService (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
youjin09222 committed Nov 16, 2023
1 parent 64cfe2a commit 324dc22
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gdsc_teamb.servertoyproject.login;

import com.gdsc_teamb.servertoyproject.jwt.TokenInfo;
import com.gdsc_teamb.servertoyproject.jwt.JwtToken;
import com.gdsc_teamb.servertoyproject.jwt.JwtTokenProvider;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
Expand All @@ -19,7 +19,7 @@ public class MemberService {
private final JwtTokenProvider jwtTokenProvider;

@Transactional
public TokenInfo login(String memberId, String password) {
public JwtToken login(String memberId, String password) {
// 1. Login ID/PW 를 기반으로 Authentication 객체 생성
// 이때 authentication 는 인증 여부를 확인하는 authenticated 값이 false
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(memberId, password);
Expand All @@ -29,8 +29,8 @@ public TokenInfo login(String memberId, String password) {
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);

// 3. 인증 정보를 기반으로 JWT 토큰 생성
TokenInfo tokenInfo = jwtTokenProvider.generateToken(authentication);
JwtToken jwtToken = jwtTokenProvider.generateToken(authentication);

return tokenInfo;
return jwtToken;
}
}

0 comments on commit 324dc22

Please sign in to comment.