Skip to content

Commit 5443334

Browse files
committed
fix: get fido device list
1 parent 25a5855 commit 5443334

File tree

3 files changed

+155
-114
lines changed

3 files changed

+155
-114
lines changed

admin-ui/configApiSpecs.yaml

+94-63
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,39 @@ paths:
632632
security:
633633
- oauth2:
634634
- 'https://jans.io/oauth/config/jans_asset-read'
635+
/api/v1/jans-assets/asset-dir-mapping:
636+
get:
637+
tags:
638+
- Jans Assets
639+
summary: Get valid asset types
640+
description: Get valid asset types
641+
operationId: get-asset-dir-mapping
642+
responses:
643+
'200':
644+
description: Ok
645+
content:
646+
application/json:
647+
schema:
648+
type: array
649+
items:
650+
$ref: '#/components/schemas/AssetDirMapping'
651+
'401':
652+
description: Unauthorized
653+
'404':
654+
description: Not Found
655+
content:
656+
application/json:
657+
schema:
658+
$ref: '#/components/schemas/ApiError'
659+
'500':
660+
description: InternalServerError
661+
content:
662+
application/json:
663+
schema:
664+
$ref: '#/components/schemas/ApiError'
665+
security:
666+
- oauth2:
667+
- 'https://jans.io/oauth/config/jans_asset-read'
635668
/api/v1/jans-assets:
636669
get:
637670
tags:
@@ -7454,17 +7487,17 @@ paths:
74547487
security:
74557488
- oauth2:
74567489
- 'https://jans.io/oauth/config/scopes.readonly'
7457-
'/api/v1/jans-auth-server/session/id/{jansId}':
7490+
'/api/v1/jans-auth-server/session/sid/{sid}':
74587491
get:
74597492
tags:
74607493
- Auth - Session Management
74617494
summary: Get session by id.
74627495
description: Get session by id.
74637496
operationId: get-session-by-id
74647497
parameters:
7465-
- name: jansId
7498+
- name: sid
74667499
in: path
7467-
description: Session Unique identifier.
7500+
description: Session identifier.
74687501
required: true
74697502
schema:
74707503
type: string
@@ -7496,15 +7529,15 @@ paths:
74967529
description: Delete a session.
74977530
operationId: delete-session
74987531
parameters:
7499-
- name: jansId
7532+
- name: sid
75007533
in: path
7501-
description: Session Unique identifier.
7534+
description: Session identifier.
75027535
required: true
75037536
schema:
75047537
type: string
75057538
responses:
7506-
'200':
7507-
description: Ok
7539+
'204':
7540+
description: No Content
75087541
'401':
75097542
description: Unauthorized
75107543
'404':
@@ -7530,8 +7563,8 @@ paths:
75307563
schema:
75317564
type: string
75327565
responses:
7533-
'200':
7534-
description: Ok
7566+
'204':
7567+
description: No Content
75357568
'401':
75367569
description: Unauthorized
75377570
'404':
@@ -7555,9 +7588,7 @@ paths:
75557588
content:
75567589
application/json:
75577590
schema:
7558-
type: array
7559-
items:
7560-
$ref: '#/components/schemas/SessionId'
7591+
$ref: '#/components/schemas/SessionPagedResult'
75617592
examples:
75627593
Response json example:
75637594
description: Response json example
@@ -8978,14 +9009,17 @@ paths:
89789009
content:
89799010
application/json:
89809011
schema:
8981-
type: array
8982-
items:
8983-
$ref: '#/components/schemas/Fido2RegistrationEntry'
9012+
$ref: '#/components/schemas/Fido2RegistrationEntryPagedResult'
89849013
examples:
89859014
Response example:
89869015
description: Response example
89879016
value: |
89889017
{
9018+
"start": 0,
9019+
"totalEntriesCount": 3,
9020+
"entriesCount": 3,
9021+
"entries": [
9022+
{
89899023
"dn": "jansId=1c88c1cb-8e32-4b79-b244-c9f677ca5654,ou=fido2_register,inum=1e73f801-22c2-4c19-a757-f96a87a5c713,ou=people,o=jans",
89909024
"id": "1c88c1cb-8e32-4b79-b244-c9f677ca5654",
89919025
"challange": "2vCSaPMIt4tZpkO8_rDG-v3QoXBYMB1aqCAXFgA4q0Y",
@@ -9099,6 +9133,8 @@ paths:
90999133
"registrationStatus": "registered",
91009134
"baseDn": "jansId=6e196a5d-122b-4f06-8ff8-6f41b32bc2a6,ou=fido2_register,inum=1e73f801-22c2-4c19-a757-f96a87a5c713,ou=people,o=jans"
91019135
}
9136+
]
9137+
}
91029138
'401':
91039139
description: Unauthorized
91049140
'500':
@@ -13254,9 +13290,7 @@ components:
1325413290
type: string
1325513291
format: date-time
1325613292
service:
13257-
type: array
13258-
items:
13259-
type: string
13293+
type: string
1326013294
level:
1326113295
type: integer
1326213296
format: int32
@@ -13285,6 +13319,28 @@ components:
1328513319
type: array
1328613320
items:
1328713321
$ref: '#/components/schemas/Document'
13322+
AssetDirMapping:
13323+
type: object
13324+
properties:
13325+
directory:
13326+
type: string
13327+
description: Relative path to asset base directory.
13328+
type:
13329+
type: array
13330+
description: List of file extention that are stored in directory.
13331+
items:
13332+
type: string
13333+
description: List of file extention that are stored in directory.
13334+
description:
13335+
type: string
13336+
description: Description of assets stored in directory.
13337+
jansServiceModule:
13338+
type: array
13339+
description: List of supported service module where asset can be uploaded.
13340+
items:
13341+
type: string
13342+
description: List of supported service module where asset can be uploaded.
13343+
description: Asset type mapped to server directory.
1328813344
AssetForm:
1328913345
required:
1329013346
- assetFile
@@ -13407,10 +13463,10 @@ components:
1340713463
type: string
1340813464
selected:
1340913465
type: boolean
13410-
adminCanView:
13411-
type: boolean
1341213466
userCanView:
1341313467
type: boolean
13468+
adminCanView:
13469+
type: boolean
1341413470
adminCanEdit:
1341513471
type: boolean
1341613472
userCanEdit:
@@ -15203,22 +15259,6 @@ components:
1520315259
$ref: '#/components/schemas/PluginConf'
1520415260
assetMgtConfiguration:
1520515261
$ref: '#/components/schemas/AssetMgtConfiguration'
15206-
AssetDirMapping:
15207-
type: object
15208-
properties:
15209-
directory:
15210-
type: string
15211-
description: Relative path to asset base directory.
15212-
type:
15213-
type: array
15214-
description: List of file extention that are stored in directory.
15215-
items:
15216-
type: string
15217-
description: List of file extention that are stored in directory.
15218-
description:
15219-
type: string
15220-
description: Description of assets stored in directory.
15221-
description: Asset type mapped to server directory.
1522215262
AssetMgtConfiguration:
1522315263
type: object
1522415264
properties:
@@ -15236,15 +15276,6 @@ components:
1523615276
description: >-
1523715277
Flag indicating if service module name extension validation is
1523815278
enabled.
15239-
assetBaseDirectory:
15240-
type: string
15241-
description: Base directory on server to upload the asset.
15242-
jansServiceModule:
15243-
type: array
15244-
description: List of supported service module where asset can be uploaded.
15245-
items:
15246-
type: string
15247-
description: List of supported service module where asset can be uploaded.
1524815279
assetDirMapping:
1524915280
type: array
1525015281
description: Asset type mapped to server directory.
@@ -15858,10 +15889,10 @@ components:
1585815889
ttl:
1585915890
type: integer
1586015891
format: int32
15861-
opbrowserState:
15862-
type: string
1586315892
persisted:
1586415893
type: boolean
15894+
opbrowserState:
15895+
type: string
1586515896
SessionIdAccessMap:
1586615897
type: object
1586715898
properties:
@@ -15871,6 +15902,22 @@ components:
1587115902
type: boolean
1587215903
xml:
1587315904
name: map
15905+
SessionPagedResult:
15906+
type: object
15907+
properties:
15908+
start:
15909+
type: integer
15910+
format: int32
15911+
totalEntriesCount:
15912+
type: integer
15913+
format: int32
15914+
entriesCount:
15915+
type: integer
15916+
format: int32
15917+
entries:
15918+
type: array
15919+
items:
15920+
$ref: '#/components/schemas/SessionId'
1587415921
User:
1587515922
type: object
1587615923
properties:
@@ -15929,22 +15976,6 @@ components:
1592915976
type: array
1593015977
items:
1593115978
$ref: '#/components/schemas/UserAuthenticator'
15932-
SessionPagedResult:
15933-
type: object
15934-
properties:
15935-
start:
15936-
type: integer
15937-
format: int32
15938-
totalEntriesCount:
15939-
type: integer
15940-
format: int32
15941-
entriesCount:
15942-
type: integer
15943-
format: int32
15944-
entries:
15945-
type: array
15946-
items:
15947-
$ref: '#/components/schemas/SessionId'
1594815979
TokenAttributes:
1594915980
type: object
1595015981
properties:

admin-ui/plugins/user-management/components/UserManagement/UserList.js

+28-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React, {
77
} from "react";
88
import MaterialTable from "@material-table/core";
99
import { DeleteOutlined } from "@mui/icons-material";
10-
import LockOpenIcon from '@mui/icons-material/LockOpen';
10+
import LockOpenIcon from "@mui/icons-material/LockOpen";
1111
import { Paper, TablePagination } from "@mui/material";
1212
import UserDetailViewPage from "./UserDetailViewPage";
1313
import {
@@ -268,7 +268,7 @@ function UserList(props) {
268268
updateUserData(JSON.stringify(jansOTPDevices));
269269
} else return false;
270270

271-
// handleView2FADetails(userDetails);
271+
handleView2FADetails(userDetails);
272272
};
273273

274274
useEffect(() => {
@@ -294,22 +294,31 @@ function UserList(props) {
294294
}, [usersList]);
295295

296296
useEffect(() => {
297-
const updatedDetails = fidoDetails.map((item) => {
298-
const attenstationRequest = JSON.parse(
299-
item.registrationData.attenstationRequest
300-
);
301-
302-
return {
303-
id: item.id,
304-
nickName: attenstationRequest.displayName ?? "-",
305-
modality: item?.deviceData?.platform ?? "-",
306-
dateAdded: moment(item.creationDate).format("YYYY-MM-DD HH:mm:ss"),
307-
type: item?.deviceData?.platform ? "SUPER GLUU" : "FIDO2",
308-
registrationData: item.registrationData,
309-
deviceData: item.deviceData,
310-
};
311-
});
312-
const removeNullValue = updatedDetails.filter((item) => item);
297+
let removeNullValue = [];
298+
if (Object.keys(fidoDetails).length > 0 && fidoDetails?.entries?.length > 0) {
299+
const updatedDetails = fidoDetails
300+
? fidoDetails?.entries?.map((item) => {
301+
const attenstationRequest = JSON.parse(
302+
item.registrationData.attenstationRequest
303+
);
304+
305+
return {
306+
id: item.id,
307+
nickName: attenstationRequest.displayName ?? "-",
308+
modality: item?.deviceData?.platform ?? "-",
309+
dateAdded: moment(item.creationDate).format(
310+
"YYYY-MM-DD HH:mm:ss"
311+
),
312+
type: item?.deviceData?.platform ? "SUPER GLUU" : "FIDO2",
313+
registrationData: item.registrationData,
314+
deviceData: item.deviceData,
315+
};
316+
})
317+
: [];
318+
removeNullValue = updatedDetails
319+
? updatedDetails?.filter((item) => item)
320+
: [];
321+
}
313322

314323
setFADetails([...removeNullValue, ...otpDevicesList]);
315324
}, [fidoDetails]);
@@ -346,6 +355,7 @@ function UserList(props) {
346355
),
347356
[pageNumber, totalItems, onPageChangeClick, limit, onRowCountChangeClick]
348357
);
358+
349359

350360
return (
351361
<GluuLoader blocking={loading}>

0 commit comments

Comments
 (0)