Fix code a bit
This commit is contained in:
@@ -17,9 +17,6 @@ import org.springframework.security.web.SecurityFilterChain;
|
|||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SecurityConfig {
|
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
|
@Bean
|
||||||
public UserDetailsService userDetailsService() {
|
public UserDetailsService userDetailsService() {
|
||||||
return new UserDetailsServiceImpl();
|
return new UserDetailsServiceImpl();
|
||||||
@@ -43,6 +40,7 @@ public class SecurityConfig {
|
|||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers("/", "/user/signUp", "/user/userList", "/user/signIn*").permitAll()
|
.antMatchers("/", "/user/signUp", "/user/userList", "/user/signIn*").permitAll()
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||||||
public UserDetails loadUserByUsername(String email) throws UserNotFoundException {
|
public UserDetails loadUserByUsername(String email) throws UserNotFoundException {
|
||||||
|
|
||||||
User user = userRepository.findByEmail(email)
|
User user = userRepository.findByEmail(email)
|
||||||
.orElseThrow(() -> new UserNotFoundException());
|
.orElseThrow(UserNotFoundException::new);
|
||||||
Set<GrantedAuthority> grantedAuthorities = new HashSet<>();
|
Set<GrantedAuthority> grantedAuthorities = new HashSet<>();
|
||||||
|
|
||||||
return new org
|
return new org
|
||||||
|
|||||||
Reference in New Issue
Block a user