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
e3a650f8
Commit
e3a650f8
authored
Aug 16, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决不安全的http方法
parent
cf7965c5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+1
-1
ResourceContrller.java
...ava/iot/sixiang/license/controller/ResourceContrller.java
+1
-1
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+6
-3
No files found.
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
e3a650f8
...
@@ -31,7 +31,7 @@ import java.util.Map;
...
@@ -31,7 +31,7 @@ import java.util.Map;
*/
*/
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/"
)
@RequestMapping
(
"/
iot_license
"
)
@Api
(
value
=
"登录模块"
,
tags
=
{
"登录模块"
})
@Api
(
value
=
"登录模块"
,
tags
=
{
"登录模块"
})
public
class
LoginController
{
public
class
LoginController
{
...
...
license/src/main/java/iot/sixiang/license/controller/ResourceContrller.java
View file @
e3a650f8
...
@@ -19,7 +19,7 @@ import java.io.IOException;
...
@@ -19,7 +19,7 @@ import java.io.IOException;
@RestController
@RestController
@RequestMapping
(
"/resource"
)
@RequestMapping
(
"/
iot_license/
resource"
)
@Api
(
value
=
"资源模块"
,
tags
=
{
"资源模块"
})
@Api
(
value
=
"资源模块"
,
tags
=
{
"资源模块"
})
public
class
ResourceContrller
{
public
class
ResourceContrller
{
...
...
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
e3a650f8
...
@@ -11,6 +11,7 @@ import javax.servlet.annotation.WebFilter;
...
@@ -11,6 +11,7 @@ import javax.servlet.annotation.WebFilter;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -35,9 +36,11 @@ public class JwtFilter implements Filter {
...
@@ -35,9 +36,11 @@ public class JwtFilter implements Filter {
final
HttpServletResponse
response
=
(
HttpServletResponse
)
servletResponse
;
final
HttpServletResponse
response
=
(
HttpServletResponse
)
servletResponse
;
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
response
.
setContentType
(
"text/html; charset=utf-8"
);
response
.
setContentType
(
"text/html; charset=utf-8"
);
if
(
"OPTIONS"
.
equals
(
request
.
getMethod
()))
{
if
(
"OPTIONS"
.
equals
(
request
.
getMethod
())
||
"HEAD"
.
equals
(
request
.
getMethod
()))
{
response
.
setStatus
(
HttpServletResponse
.
SC_OK
);
response
.
setStatus
(
HttpServletResponse
.
SC_METHOD_NOT_ALLOWED
);
filterChain
.
doFilter
(
request
,
response
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
outputStream
.
write
(
new
String
(
"不安全的请求"
.
getBytes
(),
StandardCharsets
.
UTF_8
).
getBytes
());
outputStream
.
flush
();
return
;
return
;
}
}
...
...
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