org.springframework.security.core.userdetails.User.UserBuilder Java Examples
The following examples show how to use
org.springframework.security.core.userdetails.User.UserBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityConfig.java From spring-reactive-sample with GNU General Public License v3.0 | 5 votes |
@Bean public MapReactiveUserDetailsService userDetailsRepository() { UserBuilder users = User.withDefaultPasswordEncoder(); UserDetails user = users.username("user").password("password").roles("USER").build(); UserDetails admin = users.username("admin").password("password").roles("USER", "ADMIN").build(); return new MapReactiveUserDetailsService(user, admin); }
Example #2
Source File: MavenExtension.java From spring-cloud-deployer with Apache License 2.0 | 5 votes |
@Bean public UserDetailsService userDetailsService() { UserBuilder users = User.builder(); InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager(); manager.createUser(users.username("user").password("{noop}password").roles("USER").build()); return manager; }
Example #3
Source File: Application.java From spring-data-examples with Apache License 2.0 | 5 votes |
/** * This section defines the user accounts which can be used for authentication as well as the roles each user has. */ @Bean InMemoryUserDetailsManager userDetailsManager() { UserBuilder builder = User.withDefaultPasswordEncoder(); UserDetails greg = builder.username("greg").password("turnquist").roles("USER").build(); UserDetails ollie = builder.username("ollie").password("gierke").roles("USER", "ADMIN").build(); return new InMemoryUserDetailsManager(greg, ollie); }