Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
ldp-docs
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
doc
ldp-docs
Commits
3599e8fe
Commit
3599e8fe
authored
Oct 20, 2021
by
郭人方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs:LDP框架filter修改说明文档。
parent
7ab34708
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
LDP框架filter添加前端标识说明.md
开发文档/LDP框架filter添加前端标识说明.md
+77
-0
No files found.
开发文档/LDP框架filter添加前端标识说明.md
0 → 100644
View file @
3599e8fe
# LDP 框架filter添加前端标识说明
表:ldp_uaa_app_client添加字段front_app_id
添加脚本:V1.1.7__alter_ldp_uaa_app_client.sql
依赖包:
<dependency>
<groupId>
com.sinra.ldp
</groupId>
<artifactId>
base-api
</artifactId>
<version>
${ldp.version}
</version>
</dependency>
```
java
/**
* service-uaa 添加接口 ,类:AppClientRest.java 根据frontAppId 获取信息
*
* @param frontAppId
* @return
*/
@GetMapping
(
"/getByFrontAppId"
)
public
List
<
LdpUaaAppClient
>
getByFrontAppId
(
String
frontAppId
)
{
List
<
LdpUaaAppClient
>
ldpUaaAppClient
=
appClientService
.
getByFrontAppId
(
StringUtils
.
EMPTY
,
frontAppId
);
return
ldpUaaAppClient
;
}
// Sql 脚本:
<
query
id
=
"select_app_client_list_by_frontappid"
author
=
"machao"
remark
=
"通过frontappid获取UAA客户端信息"
>
<
sql
>
<![
CDATA
[
SELECT
c
.
app_id
,
c
.
front_app_id
,
c
.
auth_realm
FROM
ldp_uaa_app_client
c
JOIN
ldp_uaa_auth_realm
r
ON
c
.
auth_realm
=
r
.
id
WHERE
c
.
status
=
1
AND
c
.
del_flag
=
0
AND
c
.
front_app_id
=
:
frontAppId
#
]]>
</
sql
>
</
query
>
```
```
java
/**
* 使用地方 LoginForwordFilter.java line 191 ~ 205
* @param tokenStr token字符
* @return
*/
RouteApp
getRouteApp
(
String
frontappId
)
{
RouteApp
routeApp
=
ldpUaaProperties
.
getRouteApps
().
stream
().
filter
(
appinfo
->
(
appinfo
.
getId
()
!=
null
&&
frontappId
.
indexOf
(
appinfo
.
getId
())
>=
0
)).
findFirst
().
get
();
if
(
null
==
routeApp
)
{
ResponseEntity
<
Map
>
responseEntity
=
restTemplate
.
getForEntity
(
"http://mcs-service/uaa/backend/client/getByFrontAppId?frontAppId="
+
frontappId
,
Map
.
class
);
System
.
out
.
println
(
responseEntity
.
getBody
());
if
(
responseEntity
.
getStatusCode
()
==
HttpStatus
.
OK
&&
CommonConstants
.
SUCCESS
.
equals
(
responseEntity
.
getBody
().
get
(
"code"
)))
{
if
(
null
!=
responseEntity
.
getBody
().
get
(
"data"
))
{
List
list
=
(
ArrayList
)
responseEntity
.
getBody
().
get
(
"data"
);
LinkedHashMap
<
String
,
String
>
map
=
(
LinkedHashMap
)
list
.
get
(
0
);
routeApp
.
setId
(
map
.
get
(
"frontAppId"
));
routeApp
.
setRealmcode
(
map
.
get
(
"authRealm"
));
routeApp
.
setClientid
(
map
.
get
(
"appId"
));
}
}
}
return
routeApp
;
}
```
\ No newline at end of file
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