in28minutes / spring-boot-examples

Code Examples for everything thats written on www.springboottutorial.com
https://www.springboottutorial.com
1.24k stars 3.36k forks source link

deprecated class NoOpPasswordEncoder in Spring boot security #6

Open sarannrich opened 5 years ago

sarannrich commented 5 years ago

The old AuthenticationManagerBuilders are no longer supported


                .roles("USER").and().withUser("admin1").password("secret1")
                .roles("USER", "ADMIN");```

They now need to be written as below.

```auth.inMemoryAuthentication()
            .withUser("user1").password("{noop}secret1").roles("USER")
            .and().withUser("admin1").password("{noop}secret1").roles("USER", "ADMIN");```

See ![this](https://stackoverflow.com/questions/50429483/spring-security-authentication-how-to-get-rid-of) solution on StackOverflow.