BAEL-9467 Update Spring Security article

-Removed redundant field
This commit is contained in:
Dhawal Kapil 2018-10-19 22:32:13 +05:30
parent 88600298a2
commit d72429a003
1 changed files with 2 additions and 5 deletions

View File

@ -23,9 +23,6 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationFa
@ComponentScan("org.baeldung.security") @ComponentScan("org.baeldung.security")
public class SecurityJavaConfig extends WebSecurityConfigurerAdapter { public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
@Autowired
private PasswordEncoder encoder;
@Autowired @Autowired
private CustomAccessDeniedHandler accessDeniedHandler; private CustomAccessDeniedHandler accessDeniedHandler;
@ -45,9 +42,9 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception { protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication() auth.inMemoryAuthentication()
.withUser("admin").password(encoder.encode("adminPass")).roles("ADMIN") .withUser("admin").password(encoder().encode("adminPass")).roles("ADMIN")
.and() .and()
.withUser("user").password(encoder.encode("userPass")).roles("USER"); .withUser("user").password(encoder().encode("userPass")).roles("USER");
} }
@Override @Override