各种优化修复

This commit is contained in:
thinkgem
2018-01-30 22:04:24 +08:00
parent 9944c08c6a
commit 2f9a1a9167
21 changed files with 452 additions and 87 deletions

View File

@@ -3,6 +3,7 @@
*/
package com.jeesite.common.shiro.filter;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletRequest;
@@ -154,6 +155,11 @@ public class FormAuthenticationFilter extends org.apache.shiro.web.filter.authc.
}
return captcha;
}
@Override
protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException {
PermissionsAuthorizationFilter.redirectToDefaultPath(request, response);
}
/**
* 地址访问接入验证
@@ -178,6 +184,7 @@ public class FormAuthenticationFilter extends org.apache.shiro.web.filter.authc.
logger.trace("Attempting to access a path which requires authentication. Forwarding to the " + "Authentication url ["
+ getLoginUrl() + "]");
}
redirectToLogin(request, response); // 此过滤器优先级较高,未登录,则跳转登录页,方便 CAS 登录
// saveRequestAndRedirectToLogin(request, response); // 去掉保存登录前的跳转地址 ThinkGem
return false;
}

View File

@@ -65,7 +65,7 @@ public class PermissionsAuthorizationFilter extends org.apache.shiro.web.filter.
*/
public static void redirectToDefaultPath(ServletRequest request, ServletResponse response) throws IOException {
// AJAX不支持Redirect改用Forward
String loginUrl = Global.getProperty("defaultPath");
String loginUrl = Global.getProperty("shiro.defaultPath");
if (ServletUtils.isAjaxRequest((HttpServletRequest) request)) {
try {
request.getRequestDispatcher(loginUrl).forward(

View File

@@ -124,9 +124,6 @@ adminPath: /a
#前端基础路径
frontPath: /f
#索引页路径
defaultPath: ${adminPath}/login
# 分页配置
page:
@@ -219,17 +216,20 @@ cms:
# Shiro 相关配置
shiro:
#索引页路径
defaultPath: ${shiro.loginUrl}
# 登录相关设置
loginUrl: ${adminPath}/login
logoutUrl: ${shiro.loginUrl}
successUrl: ${adminPath}/index
# CAS 相关配置
casServerUrl: http://192.168.1.3:8080/cas
casClientUrl: http://192.168.1.3:8180/jeesite
# casServerUrl: http://192.168.1.3:8080/cas
# casClientUrl: http://192.168.1.3:8180/jeesite
# loginUrl: ${shiro.casServerUrl}?service=${shiro.casClientUrl}${adminPath}/login-cas
# logoutUrl: ${shiro.casServerUrl}/logout?service=${shiro.loginUrl}
# successUrl: ${shiro.casClientUrl}
# successUrl: ${shiro.casClientUrl}${adminPath}/index
# SSO 登录相关配置
sso: