Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
smileNicky
jeeplatform
提交
1930ad30
J
jeeplatform
项目概览
smileNicky
/
jeeplatform
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeeplatform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1930ad30
编写于
5月 25, 2019
作者:
N
Nicky.Ma
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:新增无权访问403页面
fix:单点登录没跳转到CAS服务器问题
上级
15c070cb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
20 deletion
+65
-20
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/config/ShiroConfig.java
...c/main/java/org/muses/jeeplatform/config/ShiroConfig.java
+6
-5
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/core/CASConsts.java
...n/src/main/java/org/muses/jeeplatform/core/CASConsts.java
+15
-13
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/web/controller/LoginController.java
...org/muses/jeeplatform/web/controller/LoginController.java
+6
-0
code/jeeplatform-admin/src/main/webapp/WEB-INF/jsp/admin/frame/403.jsp
...orm-admin/src/main/webapp/WEB-INF/jsp/admin/frame/403.jsp
+36
-0
code/jeeplatform-admin/src/main/webapp/WEB-INF/web.xml
code/jeeplatform-admin/src/main/webapp/WEB-INF/web.xml
+2
-2
未找到文件。
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/config/ShiroConfig.java
浏览文件 @
1930ad30
...
...
@@ -56,7 +56,7 @@ public class ShiroConfig {
bean
.
setEnabled
(
true
);
return
bean
;
}
/**
* CAS过滤器
...
...
@@ -68,6 +68,7 @@ public class ShiroConfig {
casFilter
.
setName
(
"casFilter"
);
casFilter
.
setEnabled
(
true
);
casFilter
.
setFailureUrl
(
CAS_CLIENT_LOGIN_URL
);
casFilter
.
setSuccessUrl
(
LOGIN_SUCCESS_URL
);
return
casFilter
;
}
...
...
@@ -106,7 +107,7 @@ public class ShiroConfig {
shiroFilterFactoryBean
.
setLoginUrl
(
CAS_CLIENT_LOGIN_URL
);
shiroFilterFactoryBean
.
setSuccessUrl
(
LOGIN_SUCCESS_URL
);
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
CAS_CLIENT_LOGIN
_URL
);
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
LOGIN_UNAUTHORIZED
_URL
);
//添加CasFilter到ShiroFilter
Map
<
String
,
Filter
>
filters
=
new
HashMap
<
String
,
Filter
>();
...
...
@@ -122,9 +123,9 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/upload/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/plugins/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/code"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/login"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/logincheck"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/logout"
,
"anon"
);
//
filterChainDefinitionMap.put("/login", "anon");
//
filterChainDefinitionMap.put("/logincheck", "anon");
//
filterChainDefinitionMap.put("/logout","anon");
filterChainDefinitionMap
.
put
(
"/**"
,
"authc"
);
shiroFilterFactoryBean
.
setFilterChainDefinitionMap
(
filterChainDefinitionMap
);
...
...
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/core/CASConsts.java
浏览文件 @
1930ad30
...
...
@@ -14,21 +14,23 @@ package org.muses.jeeplatform.core;
public
class
CASConsts
{
/* CAS单点登录配置 */
//
客户端URL PREFIX
public
static
final
String
C
LIENT_URL_PREFIX
=
"http://localhost:8081/jeeplatform
"
;
//
客户端
登录地址
public
static
final
String
C
LIENT_LOGIN_URL
=
CLIENT
_URL_PREFIX
+
"/login"
;
//
客户端
登出地址
public
static
final
String
C
LIENT_LOGOUT_URL
=
CLIENT
_URL_PREFIX
+
"/logout"
;
//
CAS服务端URL PREFIX
public
static
final
String
CAS_SERVER_URL_PREFIX
=
"http://localhost:8080
"
;
//Cas过滤器
U
rlPattern
public
static
final
String
CAS_FILTER_URL_PATTERN
=
"/
cas
"
;
//CAS客户端单点登录
public
static
final
String
CAS_CLIENT_LOGIN_URL
=
C
LIENT_LOGIN_URL
+
"?service="
+
CAS_
SERVER_URL_PREFIX
+
CAS_FILTER_URL_PATTERN
;
//
Cas server地址
public
static
final
String
C
AS_SERVER_URL_PREFIX
=
"http://localhost:8080/cas
"
;
//
Cas单点
登录地址
public
static
final
String
C
AS_LOGIN_URL
=
CAS_SERVER
_URL_PREFIX
+
"/login"
;
//
CAS单点
登出地址
public
static
final
String
C
AS_LOGOUT_URL
=
CAS_SERVER
_URL_PREFIX
+
"/logout"
;
//
对外提供的服务地址
public
static
final
String
SERVER_URL_PREFIX
=
"http://localhost:8081
"
;
//Cas过滤器
的u
rlPattern
public
static
final
String
CAS_FILTER_URL_PATTERN
=
"/
jeeplatform
"
;
//CAS客户端单点登录
跳转地址
public
static
final
String
CAS_CLIENT_LOGIN_URL
=
C
AS_LOGIN_URL
+
"?service="
+
SERVER_URL_PREFIX
+
CAS_FILTER_URL_PATTERN
;
//CAS客户端单点登出
public
static
final
String
CAS_CLIENT_LOGOUT_URL
=
C
LIENT_LOGOUT_URL
+
"?service="
+
CAS_
SERVER_URL_PREFIX
+
CAS_FILTER_URL_PATTERN
;
public
static
final
String
CAS_CLIENT_LOGOUT_URL
=
C
AS_LOGOUT_URL
+
"?service="
+
SERVER_URL_PREFIX
+
CAS_FILTER_URL_PATTERN
;
//登录成功地址
public
static
final
String
LOGIN_SUCCESS_URL
=
"/index"
;
//无权访问页面403
public
static
final
String
LOGIN_UNAUTHORIZED_URL
=
"/403"
;
}
code/jeeplatform-admin/src/main/java/org/muses/jeeplatform/web/controller/LoginController.java
浏览文件 @
1930ad30
...
...
@@ -228,5 +228,11 @@ public class LoginController extends BaseController {
return
mv
;
}
@RequestMapping
(
"/403"
)
public
ModelAndView
to403PAge
(){
ModelAndView
mv
=
this
.
getModelAndView
();
mv
.
setViewName
(
"admin/frame/403"
);
return
mv
;
}
}
code/jeeplatform-admin/src/main/webapp/WEB-INF/jsp/admin/frame/403.jsp
0 → 100644
浏览文件 @
1930ad30
<%@ page
contentType=
"text/html; charset=utf-8"
pageEncoding=
"utf-8"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"fmt"
uri=
"http://java.sun.com/jsp/jstl/fmt"
%>
<%
String
path
=
request
.
getContextPath
();
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
%>
<!DOCTYPE html>
<html
lang=
"zh-CN"
>
<head>
<base
href=
"
<%=
basePath
%>
"
>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
/>
<title>
403无权访问
</title>
<style
type=
"text/css"
>
body
,
h1
,
p
{
margin
:
0
;
padding
:
0
;}
body
{
background
:
#fcfbfb
;}
.nofound
{
width
:
470px
;
margin
:
0
auto
;
padding
:
180px
0
100px
;
text-align
:
center
;
color
:
#5c6048
;
font-size
:
16px
;
line-height
:
30px
;
font-family
:
"Microsoft Yahei"
;
background
:
url(images/nofound-bg.png)
right
62px
no-repeat
;}
.nofound
p
{
padding-top
:
20px
;}
.nofound-tit
{
padding-bottom
:
32px
;
font-weight
:
normal
;
font-size
:
150px
;
line-height
:
120px
;}
.nofound-why
{
font-size
:
30px
;
line-height
:
30px
;}
.sorry
{
font-size
:
30px
;}
.back-homepage
{
color
:
#ff6000
;
font-size
:
14px
;}
</style>
</head>
<body>
<div
class=
"nofound"
>
<h1
class=
"nofound-tit"
>
403
<span
class=
"nofound-why"
>
why
</span></h1>
<p
class=
"sorry"
>
非常抱歉...
</p>
<p>
您访问的页面无权访问
</p>
<p>
您可以
<a
class=
"back-homepage"
href=
"/jeeplatform"
>
返回登录页
</a></p>
</div>
</body>
</html>
\ No newline at end of file
code/jeeplatform-admin/src/main/webapp/WEB-INF/web.xml
浏览文件 @
1930ad30
...
...
@@ -130,7 +130,7 @@
<init-param>
<!– CAS登录页面,当SessionId无法匹配Session时,跳转到CAS登录页面 –>
<param-name>casServerLoginUrl</param-name>
<param-value>http://localhost:8080/
jeeplatform-sso
/login</param-value>
<param-value>http://localhost:8080/
cas
/login</param-value>
</init-param>
<init-param>
<param-name>serverName</param-name>
...
...
@@ -148,7 +148,7 @@
<filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
<init-param>
<param-name>casServerUrlPrefix</param-name>
<param-value>http://localhost:8080/
jeeplatform-sso
</param-value>
<param-value>http://localhost:8080/
cas
</param-value>
</init-param>
<init-param>
<param-name>serverName</param-name>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录