| | |
| | | |
| | | @Override |
| | | protected void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | auth.authenticationProvider(new DaoAuthenticationProvider()); |
| | | auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder()); |
| | | } |
| | | |
| | |
| | | registry.and() |
| | | // 表单登录方式 |
| | | .formLogin() |
| | | .loginPage("/xboot/common/needLogin") |
| | | //.loginPage("/xboot/common/needLogin") |
| | | .loginPage("/index.html") |
| | | // 登录请求url |
| | | .loginProcessingUrl("/xboot/login") |
| | | //.loginProcessingUrl("/login") |
| | | .permitAll() |
| | | // 成功处理类 |
| | | .successHandler(successHandler) |
| | |
| | | .authenticated() |
| | | .and() |
| | | // 允许跨域 |
| | | .cors().and() |
| | | //.cors().and() |
| | | // 关闭跨站请求防护 |
| | | .csrf().disable() |
| | | // 前后端分离采用JWT 不需要session |
| | |
| | | // 自定义权限拒绝处理类 |
| | | .exceptionHandling().accessDeniedHandler(accessDeniedHandler) |
| | | .and() |
| | | // 图形验证码过滤器 |
| | | //图形验证码过滤器 |
| | | //.addFilterBefore(imageValidateFilter, UsernamePasswordAuthenticationFilter.class) |
| | | // 短信验证码过滤器 |
| | | //.addFilterBefore(smsValidateFilter, UsernamePasswordAuthenticationFilter.class) |