Skip to content

Commit

Permalink
optimize: 유저레벨 커버링 인덱스 구현 (id, email, role) [4] (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
in-seo authored Jan 2, 2024
2 parents 961f85a + f369580 commit abf2c7d
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ public class PrincipalDetailService implements UserDetailsService {
*/
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
User principal = userRepository.findByEmailWithIndex(email)
.orElseThrow(UserNotFoundException::new);
Object[] principal = userRepository.findByEmailWithIndex(email);

UserDetails result = org.springframework.security.core.userdetails.User.builder()
.username(principal.getEmail())
.password(String.valueOf(principal.getId()))
.roles(principal.getRoleKey())
.username((String) principal[0])
.password(String.valueOf(principal))
.roles((String) principal[2])
.build();

return result;
Expand Down

0 comments on commit abf2c7d

Please sign in to comment.