The UserDetailsService bean

We will use hardcoded user details, against which we will authenticate. This is not how it has to be done for a production-ready application, but for simplicity and to explain the concepts, let's take this shortcut:

@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
UserDetails user = User.withUsername("user")
.password("{noop}password").roles("USER").build();
UserDetails admin = User.withUsername("admin")
.password("{noop}password").roles("USER","ADMIN").build();
return new MapReactiveUserDetailsService(user, admin);
}

The bean returns the reactive user details service, containing hardcoded credentials for two users; one a normal user and the other an admin.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.67.40