mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Added login failure handler
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.cfive.pinnacle.config;
|
||||
|
||||
import com.cfive.pinnacle.filter.JwtAuthenticationTokenFilter;
|
||||
import com.cfive.pinnacle.handler.AccessDeniedHandler;
|
||||
import com.cfive.pinnacle.handler.AuthenticationEntryPointHandler;
|
||||
import com.cfive.pinnacle.service.permission.impl.UserDetailsServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -25,6 +26,7 @@ public class SecurityConfig {
|
||||
private UserDetailsServiceImpl userDetailsService;
|
||||
private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;
|
||||
private AuthenticationEntryPointHandler authenticationEntryPointHandler;
|
||||
private AccessDeniedHandler accessDeniedHandler;
|
||||
|
||||
@Autowired
|
||||
public void setUserDetailsService(UserDetailsServiceImpl userDetailsService) {
|
||||
@@ -41,6 +43,11 @@ public class SecurityConfig {
|
||||
this.authenticationEntryPointHandler = authenticationEntryPointHandler;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler) {
|
||||
this.accessDeniedHandler = accessDeniedHandler;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
@@ -94,6 +101,7 @@ public class SecurityConfig {
|
||||
|
||||
.exceptionHandling()
|
||||
.authenticationEntryPoint(authenticationEntryPointHandler)
|
||||
.accessDeniedHandler(accessDeniedHandler)
|
||||
.and()
|
||||
|
||||
.cors()
|
||||
|
||||
Reference in New Issue
Block a user