Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
b72cb1d5
Commit
b72cb1d5
authored
Oct 10, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交配置校验
parent
b9bd798e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
base-manager/pom.xml
base-manager/pom.xml
+2
-0
base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
...s/xhx/base/framework/interceptor/AuthUserInterceptor.java
+15
-2
base-manager/src/main/resources/bootstrap.yml
base-manager/src/main/resources/bootstrap.yml
+1
-1
No files found.
base-manager/pom.xml
View file @
b72cb1d5
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.req.json.check>
false
</profiles.req.json.check>
<profiles.req.json.check>
false
</profiles.req.json.check>
<profiles.trustedReferer></profiles.trustedReferer>
<package.environment>
build
</package.environment>
<package.environment>
build
</package.environment>
<skipUi>
true
</skipUi>
<skipUi>
true
</skipUi>
</properties>
</properties>
...
@@ -49,6 +50,7 @@
...
@@ -49,6 +50,7 @@
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5513
</profiles.server.debug>
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5513
</profiles.server.debug>
<profiles.nacos.server-addr>
192.168.0.252:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
192.168.0.252:8848
</profiles.nacos.server-addr>
<profiles.req.json.check>
true
</profiles.req.json.check>
<profiles.req.json.check>
true
</profiles.req.json.check>
<profiles.trustedReferer>
192.168.0.98,localhost
</profiles.trustedReferer>
</properties>
</properties>
</profile>
</profile>
...
...
base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
View file @
b72cb1d5
package
com.mortals.xhx.base.framework.interceptor
;
package
com.mortals.xhx.base.framework.interceptor
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.http.HttpStatus
;
import
cn.hutool.http.HttpStatus
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
...
@@ -22,6 +24,9 @@ import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
...
@@ -22,6 +24,9 @@ import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.net.MalformedURLException
;
import
java.net.URI
;
import
java.net.URL
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
...
@@ -52,10 +57,12 @@ public class AuthUserInterceptor extends BaseInterceptor {
...
@@ -52,10 +57,12 @@ public class AuthUserInterceptor extends BaseInterceptor {
throws
Exception
{
throws
Exception
{
//response.setContentType("application/json");
//response.setContentType("application/json");
String
referer
=
request
.
getHeader
(
"Referer"
);
String
referer
=
request
.
getHeader
(
"Referer"
);
if
(!
ObjectUtils
.
isEmpty
(
referer
))
{
if
(!
ObjectUtils
.
isEmpty
(
referer
))
{
referer
=
StrUtil
.
removeSuffix
(
referer
,
"/"
);
//校验host即可
URI
host
=
URLUtil
.
getHost
(
new
URL
(
referer
));
referer
=
host
.
getHost
();
//referer = StrUtil.removeSuffix(referer, "/");
List
<
String
>
trustReferers
=
StrUtil
.
split
(
trustedReferer
,
","
);
List
<
String
>
trustReferers
=
StrUtil
.
split
(
trustedReferer
,
","
);
if
(!
ObjectUtils
.
isEmpty
(
trustReferers
))
{
if
(!
ObjectUtils
.
isEmpty
(
trustReferers
))
{
if
(!
trustReferers
.
contains
(
referer
))
{
if
(!
trustReferers
.
contains
(
referer
))
{
...
@@ -128,4 +135,10 @@ public class AuthUserInterceptor extends BaseInterceptor {
...
@@ -128,4 +135,10 @@ public class AuthUserInterceptor extends BaseInterceptor {
}
}
public
static
void
main
(
String
[]
args
)
throws
MalformedURLException
{
String
url
=
"http://192.168.0.1:9989"
;
URI
host
=
URLUtil
.
getHost
(
new
URL
(
url
));
System
.
out
.
println
(
host
.
getHost
());
}
}
}
base-manager/src/main/resources/bootstrap.yml
View file @
b72cb1d5
...
@@ -49,4 +49,4 @@ application:
...
@@ -49,4 +49,4 @@ application:
dm
:
dm
:
enable
:
true
enable
:
true
jsonCheck
:
@
profiles.req.json.check@
jsonCheck
:
@
profiles.req.json.check@
trustedReferer
:
http://192.168.0.98:11072,http://localhost:8080
trustedReferer
:
@
profiles.trustedReferer@
\ No newline at end of file
\ No newline at end of file
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