From 43a8d7b9b93555f6c1c8526bae6074d2ab06d045 Mon Sep 17 00:00:00 2001
From: huanghongfa <18228131219@163.com>
Date: 星期三, 30 十二月 2020 19:14:46 +0800
Subject: [PATCH] 增加接口测试使用

---
 springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/config/SecurityConfig.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/config/SecurityConfig.java b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/config/SecurityConfig.java
index 05dcc3a..1b0e22a 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/config/SecurityConfig.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/config/SecurityConfig.java
@@ -1,10 +1,7 @@
 package com.panzhihua.auth.config;
 
 
-import com.panzhihua.auth.handel.UserAuthenticationProvider;
-import com.panzhihua.auth.handel.UserLoginFailureHandler;
-import com.panzhihua.auth.handel.UserLoginSuccessHandler;
-import com.panzhihua.auth.handel.UserLogoutSuccessHandler;
+import com.panzhihua.auth.handel.*;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.authentication.AuthenticationManager;
@@ -76,7 +73,7 @@
                 .and()
                 // 配置登录成功自定义处理类
                 .formLogin()
-                .successHandler(new UserLoginSuccessHandler())
+//                .successHandler(new UserLoginSuccessHandler())
                 // 配置登录失败自定义处理类
                 .failureHandler(new UserLoginFailureHandler())
                 .and()
@@ -88,6 +85,9 @@
                 .and()
                 // 开启跨域
                 .cors()
+                //异常处理(权限拒绝、登录失效等)
+                .and().exceptionHandling()
+                .authenticationEntryPoint(new AjaxAuthenticationEntryPoint())//匿名用户访问无权限资源时的异常处理;
                 .and()
                 // 取消跨站请求伪造防护
                 .csrf().disable();

--
Gitblit v1.7.1