Add UserBuilder #4095

Closed
rwinch opened this Issue Oct 18, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@rwinch
Member

rwinch commented Oct 18, 2016

This will make it easier to define users without AuthenticationManagerBuidler. For example:

@Bean
public UserDetailsManager userDetailsManager() throws Exception {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("user").password("password").roles("USER").build());
    manager.createUser(User.withUsername("admin").password("password").roles("USER","ADMIN").build());
    return manager;
}
@Bean
public UserDetailsManager userDetailsManager(DataSource dataSource) throws Exception {
    JdbcUserDetailsManager result = new JdbcUserDetailsManager(dataSource);
    result.createUser(User.withUsername("user").password("password").roles("USER").build());
    result.createUser(User.withUsername("admin").password("password").roles("USER","ADMIN).build());
    return result;
}
----

@rwinch rwinch added this to the 4.2.0 RC1 milestone Oct 18, 2016

@rwinch rwinch changed the title from UserDetailsService Builder to UserDetailsService Builders Oct 18, 2016

@rwinch rwinch changed the title from UserDetailsService Builders to Add UserBuilder Oct 21, 2016

@rwinch rwinch self-assigned this Oct 21, 2016

@rwinch rwinch closed this in f432c04 Oct 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment