Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
d6a4edad
Commit
d6a4edad
authored
Mar 20, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cas修改
parent
f28c4121
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
200 additions
and
200 deletions
+200
-200
CASAutoConfig.java
...om/yifu/cloud/plus/v1/yifu/auth/config/CASAutoConfig.java
+150
-150
SimpleUrlPatternMatcherStrategy.java
.../v1/yifu/auth/filter/SimpleUrlPatternMatcherStrategy.java
+50
-50
No files found.
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/config/CASAutoConfig.java
View file @
d6a4edad
This diff is collapsed.
Click to expand it.
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/filter/SimpleUrlPatternMatcherStrategy.java
View file @
d6a4edad
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
filter
;
//
package com.yifu.cloud.plus.v1.yifu.auth.filter;
//
import
org.jasig.cas.client.authentication.UrlPatternMatcherStrategy
;
//
import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
//
import
java.util.Arrays
;
//
import java.util.Arrays;
import
java.util.List
;
//
import java.util.List;
//
public
class
SimpleUrlPatternMatcherStrategy
implements
UrlPatternMatcherStrategy
{
//
public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
//
/**
//
/**
* 判断是否匹配这个字符串
//
* 判断是否匹配这个字符串
*
//
*
* @author licancan
//
* @author licancan
* @param url 用户请求的连接
//
* @param url 用户请求的连接
* @return {@link boolean} true:不拦截 false:必须得登录了
//
* @return {@link boolean} true:不拦截 false:必须得登录了
*/
//
*/
@Override
//
@Override
public
boolean
matches
(
String
url
)
{
//
public boolean matches(String url) {
List
<
String
>
list
=
Arrays
.
asList
(
//
List<String> list = Arrays.asList(
"/login"
,
//
"/login",
"/restLogin"
//
"/restLogin"
);
//
);
String
name
=
url
.
substring
(
url
.
lastIndexOf
(
"/"
));
//
String name = url.substring(url.lastIndexOf("/"));
//
// String url = "http://127.0.0.1:8082/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb";
//
// String url = "http://127.0.0.1:8082/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb";
// 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb 现象
//
// 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb 现象
// 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 /login 即可
//
// 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 /login 即可
//
if
(
name
.
indexOf
(
"?"
)
!=
-
1
)
{
//
if (name.indexOf("?") != -1) {
name
=
name
.
substring
(
0
,
name
.
indexOf
(
"?"
));
//
name = name.substring(0, name.indexOf("?"));
}
//
}
boolean
result
=
list
.
contains
(
name
);
//
boolean result = list.contains(name);
if
(!
result
)
{
//
if (!result) {
System
.
out
.
println
(
"拦截URL:"
+
url
);
//
System.out.println("拦截URL:" + url);
}
//
}
return
result
;
//
return result;
}
//
}
//
/**
//
/**
* 正则表达式的规则,这个地方可以是web传递过来的
//
* 正则表达式的规则,这个地方可以是web传递过来的
*
//
*
* @author licancan
//
* @author licancan
* @param pattern
//
* @param pattern
* @return void
//
* @return void
*/
//
*/
@Override
//
@Override
public
void
setPattern
(
String
pattern
)
{
//
public void setPattern(String pattern) {
System
.
out
.
println
(
11111
);
//
System.out.println(11111);
}
//
}
}
//
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment