Skip to content

Commit

Permalink
添加表达式匹配
Browse files Browse the repository at this point in the history
  • Loading branch information
kawhii committed Sep 28, 2017
1 parent a8cc06c commit fef5aa0
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 版权所有.(c)2008-2017. 卡尔科技工作室
*/

package com.carl.auth.sso.client.demo;

import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Carl
* @date 2017/9/28
* @since 1.5.0
*/
public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
protected final Logger logger = LoggerFactory.getLogger(getClass());

@Override
public boolean matches(String url) {
logger.debug("访问路径:" + url);
return url.contains("zhangsan.jsp");
}

@Override
public void setPattern(String pattern) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
<init-param>
<param-name>casServerUrlPrefix</param-name>
<param-value>https://mmoayyed.unicon.net:8443/cas</param-value>
<param-value>https://passport.sso.com:8443/cas</param-value>
</init-param>
</filter>

Expand All @@ -38,8 +38,15 @@
<param-name>serverName</param-name>
<param-value>http://localhost:8080</param-value>
</init-param>
<init-param>
<param-name>ignorePattern</param-name>
<param-value>.*</param-value>
</init-param>
<init-param>
<param-name>ignoreUrlPatternType</param-name>
<param-value>com.carl.auth.sso.client.demo.SimpleUrlPatternMatcherStrategy</param-value>
</init-param>
</filter>

<filter>
<filter-name>CAS Validation Filter</filter-name>
<!--<filter-class>org.jasig.cas.client.validation.Saml11TicketValidationFilter</filter-class>-->
Expand Down
15 changes: 15 additions & 0 deletions sso-client-demo/sso-cas-client-demo/src/main/webapp/wangwu.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%--
~ 版权所有.(c)2008-2017. 卡尔科技工作室
--%>



<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>王五</title>
</head>
<body>
需要登录才访问
</body>
</html>
14 changes: 14 additions & 0 deletions sso-client-demo/sso-cas-client-demo/src/main/webapp/zhangsan.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%--
~ 版权所有.(c)2008-2017. 卡尔科技工作室
--%>


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>张三</title>
</head>
<body>
可以不登录就访问
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"@class": "org.apereo.cas.services.RegexRegisteredService",
"serviceId": "^(http)://localhost.*",
"name": "本地服务",
"serviceId": "^(http|https)://localhost.*",
"name": "Local Services",
"id": 10000002,
"description": "这是一个本地允许的服务,通过localhost访问都允许通过",
"description": "this is a localhost service,all of can login",
"evaluationOrder": 10000000
}

0 comments on commit fef5aa0

Please sign in to comment.