Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
6891ea1f
Commit
6891ea1f
authored
Aug 04, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决未授权下载文件
parent
b78f826e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
ResourceContrller.java
...ava/iot/sixiang/license/controller/ResourceContrller.java
+4
-4
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+2
-4
No files found.
license/src/main/java/iot/sixiang/license/controller/ResourceContrller.java
View file @
6891ea1f
...
...
@@ -3,6 +3,7 @@ package iot.sixiang.license.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.resource.ResourceManager
;
...
...
@@ -27,10 +28,9 @@ public class ResourceContrller {
@ApiOperation
(
value
=
"资源下载接口"
,
notes
=
"用于下载资源"
)
@GetMapping
(
"/download"
)
@MyLog
(
title
=
"下载资源"
,
optParam
=
"#{userId}"
,
businessType
=
BusinessType
.
OTHER
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户Id"
,
required
=
true
,
dataType
=
"int"
)
public
void
downloadWorkHourRecordTemplate
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"userId"
)
int
userId
)
{
userId
=
Integer
.
valueOf
(
XssUtil
.
checkXSS
(
String
.
valueOf
(
userId
)));
@MyLog
(
title
=
"下载资源"
,
businessType
=
BusinessType
.
OTHER
)
public
void
downloadWorkHourRecordTemplate
(
HttpServletResponse
response
)
{
int
userId
=
Integer
.
valueOf
(
XssUtil
.
checkXSS
(
UserUtils
.
getLoginUserId
()));
resourceManager
.
downloadDeviceInfoExcle
(
response
,
userId
);
}
...
...
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
6891ea1f
...
...
@@ -16,8 +16,6 @@ import java.util.Map;
@WebFilter
(
filterName
=
"jwtFilter"
,
urlPatterns
=
"/*"
)
public
class
JwtFilter
implements
Filter
{
private
static
final
String
url1
=
"/login"
;
private
static
final
String
url2
=
"/resource"
;
private
static
final
String
url3
=
"/doc.html"
;
private
static
final
String
url4
=
"/v2/api-docs"
;
private
static
final
String
url7
=
"/swagger-resources"
;
...
...
@@ -44,8 +42,8 @@ public class JwtFilter implements Filter {
boolean
check
=
true
;
String
uri
=
request
.
getRequestURI
();
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url7
)
||
uri
.
contains
(
url8
))
{
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
)
{
if
(
uri
.
contains
(
url1
)||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url7
)
||
uri
.
contains
(
url8
))
{
if
(
uri
.
contains
(
url1
))
{
uri
=
XssUtil
.
checkXSS
(
uri
);
UserUtils
.
setUri
(
uri
);
}
...
...
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