Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjsgfa_mysql
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyun
zjsgfa_mysql
Commits
fd0d5dba
Commit
fd0d5dba
authored
Dec 04, 2025
by
jiang'yun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
14fc6c70
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
58 deletions
+64
-58
src/main/java/com/zjsgfa/framework/config/SecurityConfig.java
+54
-54
src/main/java/com/zjsgfa/framework/security/filter/JwtAuthenticationTokenFilter.java
+2
-0
src/main/java/com/zjsgfa/framework/security/handle/CasAuthenticationSuccessHandler.java
+1
-0
src/main/java/com/zjsgfa/framework/task/MxdyTask.java
+4
-4
src/main/java/com/zjsgfa/framework/web/service/CasUserDetailsService.java
+1
-0
src/main/java/com/zjsgfa/project/system/controller/SysIndexController.java
+2
-0
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjDjjcController.java
+0
-0
src/main/resources/static/excel/sgfamb.docx
+0
-0
No files found.
src/main/java/com/zjsgfa/framework/config/SecurityConfig.java
View file @
fd0d5dba
...
@@ -114,6 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -114,6 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
@Override
@Override
protected
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
protected
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
System
.
out
.
println
(
casProperties
.
isCasEnable
());
if
(!
casProperties
.
isCasEnable
())
{
if
(!
casProperties
.
isCasEnable
())
{
httpSecurity
httpSecurity
// CSRF禁用,因为不使用session
// CSRF禁用,因为不使用session
...
@@ -146,48 +147,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -146,48 +147,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
}
}
if
(
casProperties
.
isCasEnable
())
{
httpSecurity
// CSRF禁用,因为不使用session
.
csrf
(
csrf
->
csrf
.
disable
())
// 禁用HTTP响应标头
.
headers
((
headersCustomizer
)
->
{
headersCustomizer
.
cacheControl
(
cache
->
cache
.
disable
()).
frameOptions
(
options
->
options
.
sameOrigin
());
})
// 认证失败处理类
.
exceptionHandling
(
exception
->
exception
.
authenticationEntryPoint
(
unauthorizedHandler
))
// 基于token,所以不需要session
.
sessionManagement
(
session
->
session
.
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
))
// 注解标记允许匿名访问的url
.
authorizeHttpRequests
((
requests
)
->
{
permitAllUrl
.
getUrls
().
forEach
(
url
->
requests
.
antMatchers
(
url
).
permitAll
());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
).
permitAll
()
// 静态资源,可匿名访问
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
,
"/**/**"
).
permitAll
()
// 除上面外的所有请求全部需要鉴权认证
.
anyRequest
().
authenticated
();
});
//单点登录登出
httpSecurity
.
logout
().
permitAll
().
logoutSuccessHandler
(
logoutSuccessHandler
);
// Custom JWT based security filter
httpSecurity
.
addFilter
(
casAuthenticationFilter
())
.
addFilterBefore
(
authenticationTokenFilter
,
CasAuthenticationFilter
.
class
)
//.addFilterBefore(casLogoutFilter(), LogoutFilter.class)
.
addFilterBefore
(
singleSignOutFilter
(),
CasAuthenticationFilter
.
class
).
exceptionHandling
()
//认证失败
.
authenticationEntryPoint
(
casAuthenticationEntryPoint
());
// 添加CORS filter
httpSecurity
.
addFilterBefore
(
corsFilter
,
JwtAuthenticationTokenFilter
.
class
);
httpSecurity
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
// disable page caching
httpSecurity
.
headers
().
cacheControl
();
}
//开启cas
// if (casProperties.isCasEnable()) {
// if (casProperties.isCasEnable()) {
// httpSecurity
// httpSecurity
// // CSRF禁用,因为不使用session
// // CSRF禁用,因为不使用session
...
@@ -196,30 +155,22 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -196,30 +155,22 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// // 过滤请求
// // 过滤请求
// .authorizeRequests()
// .authorizeRequests()
// // 对于登录login 验证码captchaImage 允许匿名访问
// //.antMatchers("/login", "/captchaImage").anonymous()
// .antMatchers(
// .antMatchers(
// HttpMethod.GET,
// HttpMethod.GET,
// "/*.html",
// "/*.html",
// "/**/*.html",
// "/**/*.html",
// "/**/*.css",
// "/**/*.css",
// "/**/*.js"
// "/**/*.js",
// "/"
// ).permitAll()
// ).permitAll()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/common/download**").anonymous()
// .antMatchers("/common/download/resource**").anonymous()
// .antMatchers("/swagger-ui.html").anonymous()
// .antMatchers("/swagger-resources/**").anonymous()
// .antMatchers("/webjars/**").anonymous()
// .antMatchers("/*/api-docs").anonymous()
// .antMatchers("/druid/**").anonymous()
// .antMatchers("/websocket/**").anonymous()
// .antMatchers("/magic/web/**").anonymous()
// .antMatchers("/**/**").anonymous()
// .antMatchers("/**/**").anonymous()
// .antMatchers("/").anonymous()
// // 除上面外的所有请求全部需要鉴权认证
// // 除上面外的所有请求全部需要鉴权认证
// .anyRequest().authenticated()
// .anyRequest().authenticated()
// .and()
// .and()
// .headers().frameOptions().disable();
// .headers().frameOptions().disable();
//
// //单点登录登出
// //单点登录登出
// httpSecurity.logout().permitAll().logoutSuccessHandler(logoutSuccessHandler);
// httpSecurity.logout().permitAll().logoutSuccessHandler(logoutSuccessHandler);
// // Custom JWT based security filter
// // Custom JWT based security filter
...
@@ -236,6 +187,55 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -236,6 +187,55 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// // disable page caching
// // disable page caching
// httpSecurity.headers().cacheControl();
// httpSecurity.headers().cacheControl();
// }
// }
//开启cas
if
(
casProperties
.
isCasEnable
())
{
httpSecurity
// CSRF禁用,因为不使用session
.
csrf
().
disable
()
// 基于token,所以不需要session
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
// 过滤请求
.
authorizeRequests
()
// 对于登录login 验证码captchaImage 允许匿名访问
//.antMatchers("/login", "/captchaImage").anonymous()
.
antMatchers
(
HttpMethod
.
GET
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
).
permitAll
()
.
antMatchers
(
"/profile/**"
).
anonymous
()
.
antMatchers
(
"/common/download**"
).
anonymous
()
.
antMatchers
(
"/common/download/resource**"
).
anonymous
()
.
antMatchers
(
"/swagger-ui.html"
).
anonymous
()
.
antMatchers
(
"/swagger-resources/**"
).
anonymous
()
.
antMatchers
(
"/webjars/**"
).
anonymous
()
.
antMatchers
(
"/*/api-docs"
).
anonymous
()
.
antMatchers
(
"/druid/**"
).
anonymous
()
.
antMatchers
(
"/websocket/**"
).
anonymous
()
.
antMatchers
(
"/magic/web/**"
).
anonymous
()
// 除上面外的所有请求全部需要鉴权认证
.
anyRequest
().
authenticated
()
.
and
()
.
headers
().
frameOptions
().
disable
();
//单点登录登出
httpSecurity
.
logout
().
permitAll
().
logoutSuccessHandler
(
logoutSuccessHandler
);
// Custom JWT based security filter
httpSecurity
.
addFilter
(
casAuthenticationFilter
())
.
addFilterBefore
(
authenticationTokenFilter
,
CasAuthenticationFilter
.
class
)
//.addFilterBefore(casLogoutFilter(), LogoutFilter.class)
.
addFilterBefore
(
singleSignOutFilter
(),
CasAuthenticationFilter
.
class
).
exceptionHandling
()
//认证失败
.
authenticationEntryPoint
(
casAuthenticationEntryPoint
());
// 添加CORS filter
httpSecurity
.
addFilterBefore
(
corsFilter
,
JwtAuthenticationTokenFilter
.
class
);
httpSecurity
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
// disable page caching
httpSecurity
.
headers
().
cacheControl
();
}
}
}
/**
/**
...
...
src/main/java/com/zjsgfa/framework/security/filter/JwtAuthenticationTokenFilter.java
View file @
fd0d5dba
...
@@ -31,7 +31,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
...
@@ -31,7 +31,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
ServletException
,
IOException
throws
ServletException
,
IOException
{
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
System
.
out
.
println
(
"-----------------doFilterInternal"
+
loginUser
);
if
(
StringUtils
.
isNotNull
(
loginUser
)
&&
StringUtils
.
isNull
(
SecurityUtils
.
getAuthentication
()))
if
(
StringUtils
.
isNotNull
(
loginUser
)
&&
StringUtils
.
isNull
(
SecurityUtils
.
getAuthentication
()))
{
{
tokenService
.
verifyToken
(
loginUser
);
tokenService
.
verifyToken
(
loginUser
);
...
...
src/main/java/com/zjsgfa/framework/security/handle/CasAuthenticationSuccessHandler.java
View file @
fd0d5dba
...
@@ -46,6 +46,7 @@ public class CasAuthenticationSuccessHandler extends SavedRequestAwareAuthentica
...
@@ -46,6 +46,7 @@ public class CasAuthenticationSuccessHandler extends SavedRequestAwareAuthentica
public
void
onAuthenticationSuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
public
void
onAuthenticationSuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Authentication
authentication
)
throws
ServletException
,
IOException
{
Authentication
authentication
)
throws
ServletException
,
IOException
{
String
targetUrlParameter
=
getTargetUrlParameter
();
String
targetUrlParameter
=
getTargetUrlParameter
();
System
.
out
.
println
(
"targetUrlParameter"
+
targetUrlParameter
);
if
(
isAlwaysUseDefaultTargetUrl
()
if
(
isAlwaysUseDefaultTargetUrl
()
||
(
targetUrlParameter
!=
null
&&
StringUtils
.
hasText
(
request
.
getParameter
(
targetUrlParameter
))))
{
||
(
targetUrlParameter
!=
null
&&
StringUtils
.
hasText
(
request
.
getParameter
(
targetUrlParameter
))))
{
requestCache
.
removeRequest
(
request
,
response
);
requestCache
.
removeRequest
(
request
,
response
);
...
...
src/main/java/com/zjsgfa/framework/task/MxdyTask.java
View file @
fd0d5dba
...
@@ -24,7 +24,7 @@ public class MxdyTask {
...
@@ -24,7 +24,7 @@ public class MxdyTask {
private
MxfxjgbMapper
mxfxjgbMapper
;
private
MxfxjgbMapper
mxfxjgbMapper
;
public
void
ryParams
2
(
Long
mxid
)
public
void
ryParams
(
Long
mxid
)
{
{
Mxfxjgb
mxfxjgb
=
mxfxjgbMapper
.
selectMxfxjgbById
(
mxid
);
Mxfxjgb
mxfxjgb
=
mxfxjgbMapper
.
selectMxfxjgbById
(
mxid
);
try
{
try
{
...
@@ -40,7 +40,7 @@ public class MxdyTask {
...
@@ -40,7 +40,7 @@ public class MxdyTask {
listMap
.
add
(
map2
);
listMap
.
add
(
map2
);
map
.
put
(
"content"
,
listMap
);
map
.
put
(
"content"
,
listMap
);
map
.
put
(
"value"
,
mxfxjgb
.
getRwnr
());
map
.
put
(
"value"
,
mxfxjgb
.
getRwnr
());
String
url
=
"https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/5
3f4afd436d2417180cb27d6dc0a3e17
"
;
String
url
=
"https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/5
06d22a5e4e8479b879a836368002ac8
"
;
String
key
=
"278GANwseRJ98YbADs3G1tj7Fg40sI7d"
;
String
key
=
"278GANwseRJ98YbADs3G1tj7Fg40sI7d"
;
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
json
=
gson
.
toJson
(
map
);
String
json
=
gson
.
toJson
(
map
);
...
@@ -57,7 +57,7 @@ public class MxdyTask {
...
@@ -57,7 +57,7 @@ public class MxdyTask {
// 2. 获取内层data节点
// 2. 获取内层data节点
JsonObject
innerData
=
outerData
.
getAsJsonObject
(
"data"
);
JsonObject
innerData
=
outerData
.
getAsJsonObject
(
"data"
);
// 3. 获取"文本呈现"字段的值
// 3. 获取"文本呈现"字段的值
textPresentation
=
innerData
.
get
(
"文本呈现
_6
"
).
getAsString
();
textPresentation
=
innerData
.
get
(
"文本呈现"
).
getAsString
();
// 打印结果
// 打印结果
System
.
out
.
println
(
"文本呈现内容:\n"
+
textPresentation
);
System
.
out
.
println
(
"文本呈现内容:\n"
+
textPresentation
);
...
@@ -70,7 +70,7 @@ public class MxdyTask {
...
@@ -70,7 +70,7 @@ public class MxdyTask {
mxfxjgbMapper
.
updateMxfxjgb
(
mxfxjgb
);
mxfxjgbMapper
.
updateMxfxjgb
(
mxfxjgb
);
}
}
}
}
public
void
ryParams
(
Long
mxid
)
public
void
ryParams
2
(
Long
mxid
)
{
{
Mxfxjgb
mxfxjgb
=
mxfxjgbMapper
.
selectMxfxjgbById
(
mxid
);
Mxfxjgb
mxfxjgb
=
mxfxjgbMapper
.
selectMxfxjgbById
(
mxid
);
try
{
try
{
...
...
src/main/java/com/zjsgfa/framework/web/service/CasUserDetailsService.java
View file @
fd0d5dba
...
@@ -34,6 +34,7 @@ public class CasUserDetailsService implements AuthenticationUserDetailsService<C
...
@@ -34,6 +34,7 @@ public class CasUserDetailsService implements AuthenticationUserDetailsService<C
@Override
@Override
public
UserDetails
loadUserDetails
(
CasAssertionAuthenticationToken
token
)
throws
UsernameNotFoundException
{
public
UserDetails
loadUserDetails
(
CasAssertionAuthenticationToken
token
)
throws
UsernameNotFoundException
{
System
.
out
.
println
(
token
);
String
username
=
token
.
getName
();
String
username
=
token
.
getName
();
SysUser
user
=
userService
.
selectUserByUserName
(
username
);
SysUser
user
=
userService
.
selectUserByUserName
(
username
);
if
(
StringUtils
.
isNull
(
user
))
{
if
(
StringUtils
.
isNull
(
user
))
{
...
...
src/main/java/com/zjsgfa/project/system/controller/SysIndexController.java
View file @
fd0d5dba
package
com
.
zjsgfa
.
project
.
system
.
controller
;
package
com
.
zjsgfa
.
project
.
system
.
controller
;
import
com.zjsgfa.framework.aspectj.lang.annotation.Anonymous
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -22,6 +23,7 @@ public class SysIndexController
...
@@ -22,6 +23,7 @@ public class SysIndexController
* 访问首页,提示语
* 访问首页,提示语
*/
*/
@RequestMapping
(
"/"
)
@RequestMapping
(
"/"
)
@Anonymous
public
String
index
()
public
String
index
()
{
{
return
StringUtils
.
format
(
"欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。"
,
ruoyiConfig
.
getName
(),
ruoyiConfig
.
getVersion
());
return
StringUtils
.
format
(
"欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。"
,
ruoyiConfig
.
getName
(),
ruoyiConfig
.
getVersion
());
...
...
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjDjjcController.java
View file @
fd0d5dba
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/resources/static/excel/sgfamb.docx
View file @
fd0d5dba
No preview for this file type
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