Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. @Configuration
  2. @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
  3. public class SecurityConfig extends WebSecurityConfigurerAdapter {
  4.  
  5. @Autowired
  6. private UserDetailsService userDetailsService;
  7.  
  8. @Override
  9. protected void configure(HttpSecurity http) throws Exception {
  10. http.authorizeRequests()
  11. .anyRequest()
  12. .authenticated()
  13. .and()
  14. .formLogin()
  15. .loginPage("/login")
  16. .failureUrl("/login?error")
  17. .usernameParameter("rekruter")
  18. .permitAll()
  19. .and()
  20. .logout()
  21. .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
  22. .logoutSuccessUrl("/")
  23. .permitAll();
  24. }
  25.  
  26. @Override
  27. public void configure(AuthenticationManagerBuilder auth) throws Exception {
  28. auth
  29. .userDetailsService(userDetailsService)
  30. .passwordEncoder(NoOpPasswordEncoder.getInstance());
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement