Fix code a bit
This commit is contained in:
@@ -17,9 +17,6 @@ import org.springframework.security.web.SecurityFilterChain;
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class SecurityConfig {
|
||||
// private final UserRepository userRepository;
|
||||
// https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter
|
||||
// https://github.com/spring-projects/spring-security/issues/10822
|
||||
@Bean
|
||||
public UserDetailsService userDetailsService() {
|
||||
return new UserDetailsServiceImpl();
|
||||
@@ -43,6 +40,7 @@ public class SecurityConfig {
|
||||
.authorizeRequests()
|
||||
.antMatchers("/", "/user/signUp", "/user/userList", "/user/signIn*").permitAll()
|
||||
.anyRequest().authenticated();
|
||||
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
public UserDetails loadUserByUsername(String email) throws UserNotFoundException {
|
||||
|
||||
User user = userRepository.findByEmail(email)
|
||||
.orElseThrow(() -> new UserNotFoundException());
|
||||
.orElseThrow(UserNotFoundException::new);
|
||||
Set<GrantedAuthority> grantedAuthorities = new HashSet<>();
|
||||
|
||||
return new org
|
||||
|
||||
Reference in New Issue
Block a user