Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
b3d99b3e
Commit
b3d99b3e
authored
May 10, 2017
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高仿一个函谷关的登录验证接口的返回,实际已去函谷关验证用户登录了
parent
306949d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
AuthInfoController.java
...up/xyqb/controller/internal/login/AuthInfoController.java
+5
-1
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/login/AuthInfoController.java
View file @
b3d99b3e
...
...
@@ -10,6 +10,7 @@ import cn.quantgroup.xyqb.service.http.IHttpService;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -28,6 +29,7 @@ import java.util.Map;
*/
@RestController
@RequestMapping
(
"/auth"
)
@Slf4j
public
class
AuthInfoController
implements
IBaseController
{
...
...
@@ -45,6 +47,7 @@ public class AuthInfoController implements IBaseController {
public
JsonResult
loginInfo
()
{
SessionStruct
sessionStruct
=
getCurrentSessionFromRedis
();
if
(
null
!=
sessionStruct
)
{
log
.
info
(
"从支付中心获取到了用户登录信息:phone:[{}]"
,
sessionStruct
.
getValues
().
getUser
().
getPhoneNo
());
LoginInfo
loginInfo
=
new
LoginInfo
();
loginInfo
.
setUser
(
UserRet
.
getUserRet
(
sessionStruct
.
getValues
().
getUser
()));
loginInfo
.
setToken
(
sessionStruct
.
getSid
());
...
...
@@ -56,6 +59,7 @@ public class AuthInfoController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
""
,
loginInfo
);
//有ThreadLocal不释放的问题,不可再使用原来方式了
}
else
{
// 函谷关去查token 返回值高仿
log
.
info
(
"去向函谷关查询用户信息"
);
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
token
=
request
.
getHeader
(
"x-auth-token"
);
if
(
StringUtils
.
isBlank
(
token
)
||
token
.
length
()
!=
36
){
...
...
@@ -64,7 +68,7 @@ public class AuthInfoController implements IBaseController {
String
checkUrl
=
xyqbAuthUrl
+
"/innerapi/is_login"
;
ImmutableMap
<
String
,
String
>
headMap
=
ImmutableMap
.
of
(
"x-auth-token"
,
token
);
String
response
=
httpService
.
get
(
checkUrl
,
headMap
,
null
);
log
.
info
(
"去向函谷关查询用户信息,response:[{}]"
,
response
);
JsonResult
result
=
JSONObject
.
parseObject
(
response
,
JsonResult
.
class
);
if
(
result
==
null
||
!
"0000"
.
equals
(
result
.
getCode
())
||
!
"0000"
.
equals
(
result
.
getBusinessCode
()))
{
return
JsonResult
.
buildErrorStateResult
(
"用户未登录"
,
null
);
...
...
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