- Timestamp:
- 05/24/23 23:18:47 (18 months ago)
- Branches:
- master
- Children:
- 77205be
- Parents:
- 8bcd64c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/services/PostgresUserDetailsService.java
r8bcd64c r950fa0d 8 8 import edu.gjoko.schedlr.repositories.StakeholderRepository; 9 9 import lombok.RequiredArgsConstructor; 10 import org.springframework.security.access.AccessDeniedException;11 10 import org.springframework.security.core.GrantedAuthority; 12 11 import org.springframework.security.core.authority.SimpleGrantedAuthority; … … 15 14 import org.springframework.security.core.userdetails.UserDetailsService; 16 15 import org.springframework.security.core.userdetails.UsernameNotFoundException; 17 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;18 16 import org.springframework.stereotype.Service; 19 17 … … 26 24 27 25 private final StakeholderRepository stakeholderRepository; 28 private final BCryptPasswordEncoder bCryptPasswordEncoder;29 30 26 private final BusinessRepository businessRepository; 31 27 … … 33 29 public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 34 30 Stakeholder user = stakeholderRepository.findStakeholderByUsername(username); 35 if (user == null) {31 if (user == null) { 36 32 throw new UsernameNotFoundException("Non existing user"); 37 33 } 38 34 39 if (user.getStakeholderType() == StakeholderType.BUSINESS_OWNER) {35 if (user.getStakeholderType() == StakeholderType.BUSINESS_OWNER) { 40 36 Business business = businessRepository.findBusinessByOwner(user); 41 37 if (business.getBusinessStatus() != BusinessStatus.ACTIVE) {
Note:
See TracChangeset
for help on using the changeset viewer.