Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lcj-btp-java-app
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
郭智朋
lcj-btp-java-app
Commits
72d8623a
Commit
72d8623a
authored
Jan 28, 2025
by
guozhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
odata鉴权
parent
7c22bdcd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
OperateAuthFilter.java
...stomer/lianchuangjie/common/filter/OperateAuthFilter.java
+1
-1
LoginServiceImpl.java
...r/lianchuangjie/master/service/impl/LoginServiceImpl.java
+4
-0
xs-security.json
xs-security.json
+2
-2
No files found.
srv/src/main/java/customer/lianchuangjie/common/filter/OperateAuthFilter.java
View file @
72d8623a
...
@@ -95,7 +95,7 @@ public class OperateAuthFilter implements Filter {
...
@@ -95,7 +95,7 @@ public class OperateAuthFilter implements Filter {
Collection
<?
extends
GrantedAuthority
>
authorities
=
authentication
.
getAuthorities
();
//权限的集合
Collection
<?
extends
GrantedAuthority
>
authorities
=
authentication
.
getAuthorities
();
//权限的集合
Object
credentials
=
authentication
.
getCredentials
();
//获取凭证
Object
credentials
=
authentication
.
getCredentials
();
//获取凭证
Object
details
=
authentication
.
getDetails
();
//获取详细信息
Object
details
=
authentication
.
getDetails
();
//获取详细信息
org
.
springframework
.
security
.
core
.
userdetails
.
User
principal
=
(
User
)
authentication
.
getPrincipal
();
//获取主体信息
org
.
springframework
.
security
.
core
.
userdetails
.
User
principal
=
(
org
.
springframework
.
security
.
core
.
userdetails
.
User
)
authentication
.
getPrincipal
();
//获取主体信息
//Collection<GrantedAuthority> authorities0 = principal.getAuthorities();
//Collection<GrantedAuthority> authorities0 = principal.getAuthorities();
boolean
isAuthenticated
=
authentication
.
isAuthenticated
();
//判断是否已认证
boolean
isAuthenticated
=
authentication
.
isAuthenticated
();
//判断是否已认证
log
.
info
(
"用户名:{}"
,
name
);
log
.
info
(
"用户名:{}"
,
name
);
...
...
srv/src/main/java/customer/lianchuangjie/master/service/impl/LoginServiceImpl.java
View file @
72d8623a
...
@@ -65,6 +65,8 @@ public class LoginServiceImpl implements LoginService {
...
@@ -65,6 +65,8 @@ public class LoginServiceImpl implements LoginService {
try
{
try
{
// 打印日志
// 打印日志
log
.
info
(
"【用户ID:{},尝试登录】"
,
userLoginId
);
log
.
info
(
"【用户ID:{},尝试登录】"
,
userLoginId
);
log
.
info
(
"authorization {}"
,
req
.
getHeader
(
"authorization"
));
log
.
info
(
"cookie {}"
,
req
.
getHeader
(
"cookie"
));
String
finalUserLoginId
=
userLoginId
;
String
finalUserLoginId
=
userLoginId
;
CqnSelect
cqnselect
=
Select
.
from
(
UserLogin_
.
class
)
CqnSelect
cqnselect
=
Select
.
from
(
UserLogin_
.
class
)
...
@@ -93,6 +95,8 @@ public class LoginServiceImpl implements LoginService {
...
@@ -93,6 +95,8 @@ public class LoginServiceImpl implements LoginService {
HttpClient
client
=
HttpClients
.
createDefault
();
HttpClient
client
=
HttpClients
.
createDefault
();
// 创建Get请求
// 创建Get请求
HttpGet
httpGet
=
new
HttpGet
(
uri
);
HttpGet
httpGet
=
new
HttpGet
(
uri
);
//添加鉴权 authorization Basic c2FiaW5lOnBhc3Nfc2FiaW5l
httpGet
.
setHeader
(
"authorization"
,
req
.
getHeader
(
"authorization"
));
JSONObject
jsonObject1
=
null
;
JSONObject
jsonObject1
=
null
;
HttpResponse
res
=
client
.
execute
(
httpGet
);
HttpResponse
res
=
client
.
execute
(
httpGet
);
// 返回json格式:
// 返回json格式:
...
...
xs-security.json
View file @
72d8623a
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
],
],
"role-collections"
:
[
"role-collections"
:
[
{
{
"name"
:
"
Lcjrepor
t_Administrators"
,
"name"
:
"
lianchuangjie-tes
t_Administrators"
,
"description"
:
"L
cjrepor
t Administrators"
,
"description"
:
"L
ianchuangjie-tes
t Administrators"
,
"role-template-references"
:
[
"role-template-references"
:
[
"$XSAPPNAME.Administrators"
"$XSAPPNAME.Administrators"
]
]
...
...
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