In-Memory User Store Example: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Spring Security Concepts <syntaxhighlight lang='java'> @Configuration @EnableWebSecurity public class Security...")
 
 
Line 3: Line 3:
* [[Spring_Security_Concepts#In-Memory_User_Store|Spring Security Concepts]]
* [[Spring_Security_Concepts#In-Memory_User_Store|Spring Security Concepts]]


=Example=
<syntaxhighlight lang='java'>
<syntaxhighlight lang='java'>
@Configuration
@Configuration

Latest revision as of 21:50, 21 October 2018

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");
    }
}