-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6d3cf0
commit b257266
Showing
10 changed files
with
117 additions
and
208 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
33 changes: 0 additions & 33 deletions
33
backend/src/main/java/com/infp/ciat/config/security/RequestLoginDTO.java
This file was deleted.
Oops, something went wrong.
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
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
37 changes: 14 additions & 23 deletions
37
backend/src/main/java/com/infp/ciat/user/service/AccountService.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,50 +1,41 @@ | ||
package com.infp.ciat.user.service; | ||
|
||
import com.infp.ciat.user.controller.dto.AccountContext; | ||
import com.infp.ciat.user.controller.dto.request.SignupRequestDTO; | ||
import com.infp.ciat.user.entity.Account; | ||
import com.infp.ciat.user.entity.Role; | ||
import com.infp.ciat.user.repository.AccountRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.core.userdetails.UserDetailsService; | ||
import org.springframework.security.core.userdetails.UsernameNotFoundException; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Service | ||
@Transactional(readOnly = true) | ||
@Slf4j | ||
public class AccountService implements UserDetailsService { | ||
public class AccountService { | ||
|
||
private final AccountRepository accountRepository; | ||
|
||
private final PasswordEncoder passwordEncoder; | ||
|
||
|
||
|
||
/*** | ||
* 회원가입서비스 | ||
* 회원중복검사는 JPA가 수행하여 생략 | ||
* Role은 default로 USER | ||
* @param requestdto | ||
*/ | ||
@Transactional | ||
public Long SignUp(SignupRequestDTO requestdto){ | ||
Account new_account = Account.builder() | ||
.email(requestdto.getEmail()) | ||
.nickname(requestdto.getNickname()) | ||
.password(passwordEncoder.encode(requestdto.getPassword())) | ||
.role(Role.ROLE_USER) | ||
.build(); | ||
|
||
return accountRepository.save(new_account).getId(); | ||
} | ||
public Long signUp(SignupRequestDTO requestdto){ | ||
|
||
@Override | ||
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { | ||
Account find_user = accountRepository.findByEmail(email) | ||
.orElseThrow(() -> new UsernameNotFoundException("사용자가 없습니다")); | ||
log.debug(String.format("%s 계정 로그인 시도", email)); | ||
return AccountContext.FromAccountToAccountContext(find_user); | ||
requestdto.setPassword(passwordEncoder.encode(requestdto.getPassword())); | ||
Account accountEntity = requestdto.toEntity(); | ||
|
||
return accountRepository.save(accountEntity).getId(); | ||
} | ||
|
||
} |
55 changes: 0 additions & 55 deletions
55
backend/src/test/java/com/infp/ciat/user/controller/AccountControllerTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.