In-Memory User Store Example

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Example

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.
           inMemoryAuthentication().
                withUser("alice").
                password("alice123").
                authorities("ROLE_USER").
                and().
                withUser("bob").
                password("bob123").
                authorities("ROLE_USER");
    }
}