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.