Created
May 10, 2014 04:10
-
-
Save Ivajkin/2e1c229beff441480040 to your computer and use it in GitHub Desktop.
HttpSecurity под Spring Security из http://docs.spring.io/autorepo/docs/spring-security/3.2.x/apidocs/org/springframework/security/config/annotation/web/builders/HttpSecurity.html#rememberMe%28%29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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