我正在尝试使用 spring security 5 验证使用。
@Configuration
@ComponentScan(basePackages = { "com.lashes.studio.security" })
@EnableWebSecurity
public class CustomSecurityService extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationSuccessHandler myAuthenticationSuccessHandler;
@Autowired
private AuthenticationFailureHandler authenticationFailureHandler;
@Autowired
private LogoutSuccessHandler myLogoutSuccessHandler;
@Autowired
private MyUserDetailsService userDetailsService;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(SecurityUtils.passwordEncoder());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/mail.js/**", "/font-awesome/**", "/css/**", "/js/**", "/img/**", "/fonts/**",
"/login*", "/login*", "/logout*", "/signin/**", "/signup/**", "/customLogin",
"/user/registration*", "/registrationConfirm*", "/expiredAccount*", "/registration*",
"/badUser*", "/user/resendRegistrationToken*", "/forgetPassword*", "/user/resetPassword*",
"/user/changePassword*", "/adminlogin/**", "/eauthenticationmanagerbuildermailError*",
"/admin/**", "/admin/js/**", "/resources/**", "/old/user/registration*", "/successRegister*")
.permitAll()
}
青春有我
相关分类