|  | 
| 14 | 14 | import org.springframework.security.core.userdetails.UserDetailsService; | 
| 15 | 15 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | 
| 16 | 16 | import org.springframework.security.crypto.password.PasswordEncoder; | 
|  | 17 | +import org.springframework.security.web.csrf.CsrfFilter; | 
| 17 | 18 | 
 | 
| 18 | 19 | @Configuration | 
| 19 | 20 | @EnableWebSecurity | 
| @@ -52,12 +53,10 @@ protected void configure(AuthenticationManagerBuilder auth) throws Exception { | 
| 52 | 53 |  @Override | 
| 53 | 54 |  protected void configure(HttpSecurity http) throws Exception { | 
| 54 | 55 |  http | 
| 55 |  | - .formLogin().disable() | 
| 56 |  | -// .httpBasic().realmName(realm).and() | 
| 57 |  | -// .csrf().disable().addFilterBefore(statelessCsrfFilter, CsrfFilter.class) | 
| 58 |  | - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); | 
| 59 |  | -// .and() | 
| 60 |  | -// .exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint); | 
|  | 56 | + .formLogin().disable().httpBasic().realmName(realm).and() | 
|  | 57 | + .csrf().disable().addFilterBefore(statelessCsrfFilter, CsrfFilter.class) | 
|  | 58 | + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() | 
|  | 59 | + .exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint); | 
| 61 | 60 |  } | 
| 62 | 61 | 
 | 
| 63 | 62 | 
 | 
|  | 
0 commit comments