mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-08 13:16:41 +08:00
security-结构调整
This commit is contained in:
parent
d54d7b544a
commit
c2596ed417
@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.smartadmin.service.handler;
|
package net.lab1024.smartadmin.service.common.security;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import net.lab1024.smartadmin.service.common.codeconst.LoginResponseCodeConst;
|
import net.lab1024.smartadmin.service.common.codeconst.LoginResponseCodeConst;
|
||||||
@ -15,8 +15,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* 认证失败处理
|
* 认证失败处理
|
||||||
*/
|
*/
|
||||||
@Component
|
public class SmartSecurityAuthenticationFailHandler implements AuthenticationEntryPoint {
|
||||||
public class AuthenticationFailHandler implements AuthenticationEntryPoint {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException {
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException {
|
@ -2,7 +2,7 @@ package net.lab1024.smartadmin.service.config;
|
|||||||
|
|
||||||
import net.lab1024.smartadmin.service.filter.SmartSecurityTokenFilter;
|
import net.lab1024.smartadmin.service.filter.SmartSecurityTokenFilter;
|
||||||
import net.lab1024.smartadmin.service.common.security.SmartSecurityUrlMatchers;
|
import net.lab1024.smartadmin.service.common.security.SmartSecurityUrlMatchers;
|
||||||
import net.lab1024.smartadmin.service.handler.AuthenticationFailHandler;
|
import net.lab1024.smartadmin.service.common.security.SmartSecurityAuthenticationFailHandler;
|
||||||
import net.lab1024.smartadmin.service.module.system.login.EmployeeLoginTokenService;
|
import net.lab1024.smartadmin.service.module.system.login.EmployeeLoginTokenService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -31,11 +31,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
|
|
||||||
@Value("${access-control-allow-origin}")
|
@Value("${access-control-allow-origin}")
|
||||||
private String accessControlAllowOrigin;
|
private String accessControlAllowOrigin;
|
||||||
/**
|
|
||||||
* 认证失败处理类
|
|
||||||
*/
|
|
||||||
@Autowired
|
|
||||||
private AuthenticationFailHandler authenticationFailHandler;
|
|
||||||
/**
|
/**
|
||||||
* url
|
* url
|
||||||
*/
|
*/
|
||||||
@ -74,7 +69,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
// CSRF禁用,因为不使用session
|
// CSRF禁用,因为不使用session
|
||||||
.csrf().disable()
|
.csrf().disable()
|
||||||
// 认证失败处理类
|
// 认证失败处理类
|
||||||
.exceptionHandling().authenticationEntryPoint(authenticationFailHandler).and()
|
.exceptionHandling().authenticationEntryPoint(new SmartSecurityAuthenticationFailHandler()).and()
|
||||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||||
// 过滤请求
|
// 过滤请求
|
||||||
.authorizeRequests();
|
.authorizeRequests();
|
||||||
|
Loading…
Reference in New Issue
Block a user