JAVA-8794: Fix circural dependencies in spring-security-core
This commit is contained in:
		
							parent
							
								
									8fd644c450
								
							
						
					
					
						commit
						fafeb12f5c
					
				| @ -0,0 +1,15 @@ | |||||||
|  | package com.baeldung.app.config; | ||||||
|  | 
 | ||||||
|  | import org.springframework.context.annotation.Bean; | ||||||
|  | import org.springframework.context.annotation.Configuration; | ||||||
|  | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||||||
|  | import org.springframework.security.crypto.password.PasswordEncoder; | ||||||
|  | 
 | ||||||
|  | @Configuration | ||||||
|  | public class PasswordEncoderConfig { | ||||||
|  | 
 | ||||||
|  |     @Bean | ||||||
|  |     public PasswordEncoder passwordEncoder() { | ||||||
|  |         return new BCryptPasswordEncoder(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -22,15 +22,11 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Autowired |     @Autowired | ||||||
|     public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { |     public void configureGlobal(AuthenticationManagerBuilder auth, PasswordEncoder passwordEncoder) throws Exception { | ||||||
|         auth.inMemoryAuthentication() |         auth.inMemoryAuthentication() | ||||||
|             .withUser("jim").password(passwordEncoder().encode("jim")).roles("USER", "ACTUATOR") |             .withUser("jim").password(passwordEncoder.encode("jim")).roles("USER", "ACTUATOR") | ||||||
|             .and().withUser("pam").password(passwordEncoder().encode("pam")).roles("USER") |             .and().withUser("pam").password(passwordEncoder.encode("pam")).roles("USER") | ||||||
|             .and().withUser("michael").password(passwordEncoder().encode("michael")).roles("MANAGER"); |             .and().withUser("michael").password(passwordEncoder.encode("michael")).roles("MANAGER"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean |  | ||||||
|     public PasswordEncoder passwordEncoder() { |  | ||||||
|         return new BCryptPasswordEncoder(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user