Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
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
quanku
qk_backend
Commits
9cebdf86
Commit
9cebdf86
authored
Jul 21, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跨域
parent
93203234
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
ch-admin-api/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
...i/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
+16
-1
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
View file @
9cebdf86
package
com.wwdz.ch.admin.config
;
package
com.wwdz.ch.admin.config
;
import
java.io.IOException
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -20,9 +21,13 @@ import org.springframework.context.annotation.DependsOn;
...
@@ -20,9 +21,13 @@ import org.springframework.context.annotation.DependsOn;
import
com.wwdz.ch.admin.shiro.AdminAuthorizingRealm
;
import
com.wwdz.ch.admin.shiro.AdminAuthorizingRealm
;
import
com.wwdz.ch.admin.shiro.AdminWebSessionManager
;
import
com.wwdz.ch.admin.shiro.AdminWebSessionManager
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.web.filter.GenericFilterBean
;
import
javax.servlet.*
;
import
javax.servlet.http.HttpServletResponse
;
@Configuration
@Configuration
public
class
ShiroConfig
{
public
class
ShiroConfig
extends
GenericFilterBean
{
@Bean
@Bean
public
Realm
realm
()
{
public
Realm
realm
()
{
...
@@ -83,4 +88,14 @@ public class ShiroConfig {
...
@@ -83,4 +88,14 @@ public class ShiroConfig {
creator
.
setProxyTargetClass
(
true
);
creator
.
setProxyTargetClass
(
true
);
return
creator
;
return
creator
;
}
}
@Override
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
HttpServletResponse
resp
=
(
HttpServletResponse
)
servletResponse
;
resp
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
resp
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
resp
.
setHeader
(
"Access-Control-Allow-Methods"
,
"POST, GET, PUT, PATCH, DELETE"
);
resp
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
}
}
}
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