Skip to content

Instantly share code, notes, and snippets.

@Ivajkin
Created May 10, 2014 04:10
Show Gist options
  • Select an option

  • Save Ivajkin/2e1c229beff441480040 to your computer and use it in GitHub Desktop.

Select an option

Save Ivajkin/2e1c229beff441480040 to your computer and use it in GitHub Desktop.
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth)
throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/**").hasRole("USER")
.and()
.formLogin()
.permitAll()
.and()
.rememberMe();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment