Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
8204ccf6
Commit
8204ccf6
authored
Jan 13, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
鉴权-fxj
parent
a18b87ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
YifuWxLoginSuccessHandler.java
.../plus/v1/yifu/auth/handler/YifuWxLoginSuccessHandler.java
+7
-5
No files found.
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/handler/YifuWxLoginSuccessHandler.java
View file @
8204ccf6
...
...
@@ -50,18 +50,18 @@ public class YifuWxLoginSuccessHandler implements AuthenticationSuccessHandler {
@Override
public
void
onAuthenticationSuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Authentication
authentication
)
throws
IOException
,
ServletException
{
String
header
=
request
.
getHeader
(
SecurityConstants
.
CLIENT_HEADER_KEY_NEW
);
/*
String header = request.getHeader(SecurityConstants.CLIENT_HEADER_KEY_NEW);
if(Common.isEmpty(header)){
header = request.getHeader(SecurityConstants.CLIENT_HEADER_KEY);
//兼容老逻辑
if(Common.isEmpty(header)){
header = request.getHeader(HttpHeaders.AUTHORIZATION);
}
}
}
*/
YifuUser
user
=
null
;
try
{
user
=
(
YifuUser
)
authentication
.
getPrincipal
();
if
(
header
==
null
)
{
/*
if (header == null) {
throw new InvalidClientException("请求头中client信息为空");
}
String[] tokens = AuthUtils.extractAndDecodeHeader(header);
...
...
@@ -73,9 +73,11 @@ public class YifuWxLoginSuccessHandler implements AuthenticationSuccessHandler {
//校验secret
if (!passwordEncoder.matches(tokens[1], clientDetails.getClientSecret())) {
throw new InvalidClientException("请求头中client信息验证异常");
}
TokenRequest
tokenRequest
=
new
TokenRequest
(
MapUtil
.
newHashMap
(),
clientId
,
clientDetails
.
getScope
(),
"password"
);
}*/
//TokenRequest tokenRequest = new TokenRequest(MapUtil.newHashMap(), clientId, clientDetails.getScope(), "password");
TokenRequest
tokenRequest
=
new
TokenRequest
(
MapUtil
.
newHashMap
(),
null
,
null
,
"password"
);
//校验scope
ClientDetails
clientDetails
=
clientDetailsService
.
loadClientByClientId
(
null
);
new
DefaultOAuth2RequestValidator
().
validateScope
(
tokenRequest
,
clientDetails
);
OAuth2Request
oAuth2Request
=
tokenRequest
.
createOAuth2Request
(
clientDetails
);
OAuth2Authentication
oAuth2Authentication
=
new
OAuth2Authentication
(
oAuth2Request
,
authentication
);
...
...
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