-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): revert restructuring of fido and schema plugin #1246
- Loading branch information
1 parent
13a5fd8
commit aecd484
Showing
40 changed files
with
330 additions
and
480 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../plugins/fido/__tests__/FidoPage.test.tsx → ...i/plugins/fido/__tests__/FidoPage.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import React, { useEffect } from 'react' | ||
import StaticConfiguration from './StaticConfiguration' | ||
import DynamicConfiguration from './DynamicConfiguration' | ||
import GluuTabs from 'Routes/Apps/Gluu/GluuTabs' | ||
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader' | ||
import { useTranslation } from 'react-i18next' | ||
import { Card, CardBody } from 'Components' | ||
import SetTitle from 'Utils/SetTitle' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import { | ||
getFidoConfiguration, | ||
putFidoConfiguration, | ||
} from '../redux/features/fidoSlice' | ||
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle' | ||
|
||
const tabNames = ['Dynamic Configuration', 'Static Configuration'] | ||
|
||
const fidoApiPayload = ({ fidoConfiguration, data }) => { | ||
const payload = fidoConfiguration.fido | ||
payload.authenticatorCertsFolder = data.authenticatorCertsFolder | ||
payload.mdsCertsFolder = data.mdsCertsFolder | ||
payload.mdsTocsFolder = data.mdsTocsFolder | ||
payload.checkU2fAttestations = data.checkU2fAttestations | ||
payload.unfinishedRequestExpiration = data.unfinishedRequestExpiration | ||
payload.authenticationHistoryExpiration = data.authenticationHistoryExpiration | ||
payload.serverMetadataFolder = data.serverMetadataFolder | ||
payload.userAutoEnrollment = data.userAutoEnrollment | ||
payload.requestedCredentialTypes = data.requestedCredentialTypes.map((item) => | ||
item?.value ? item?.value : item | ||
) | ||
payload.requestedParties = data.requestedParties.map((item) => { | ||
return { | ||
name: item.key, | ||
domains: [item.key], | ||
} | ||
}) | ||
|
||
const newPayload = { | ||
...fidoConfiguration.fido, | ||
fido2Configuration: payload, | ||
} | ||
|
||
const opts = {} | ||
const fiodData = JSON.stringify(newPayload) | ||
opts['appConfiguration1'] = JSON.parse(fiodData) | ||
|
||
return opts | ||
} | ||
|
||
const fidoApiPayloadDynamicConfig = ({ fidoConfiguration, data }) => { | ||
const payload = fidoConfiguration.fido | ||
payload.issuer = data.issuer | ||
payload.baseEndpoint = data.baseEndpoint | ||
payload.cleanServiceInterval = data.cleanServiceInterval | ||
payload.cleanServiceBatchChunkSize = data.cleanServiceBatchChunkSize | ||
payload.useLocalCache = data.useLocalCache | ||
payload.disableJdkLogger = data.disableJdkLogger | ||
payload.loggingLevel = data.loggingLevel | ||
payload.loggingLayout = data.loggingLayout | ||
payload.externalLoggerConfiguration = data.externalLoggerConfiguration | ||
payload.metricReporterEnabled = data.metricReporterEnabled | ||
payload.metricReporterInterval = data.metricReporterInterval | ||
payload.metricReporterKeepDataDays = data.metricReporterKeepDataDays | ||
payload.personCustomObjectClassList = data.personCustomObjectClassList | ||
payload.superGluuEnabled = data.superGluuEnabled | ||
payload.personCustomObjectClassList = data.personCustomObjectClassList.map( | ||
(item) => (item?.value ? item?.value : item) | ||
) | ||
|
||
const opts = {} | ||
const fiodData = JSON.stringify(payload) | ||
opts['appConfiguration1'] = JSON.parse(fiodData) | ||
|
||
return opts | ||
} | ||
|
||
export default function Fido() { | ||
const { t } = useTranslation() | ||
SetTitle(t('titles.fido_management')) | ||
const dispatch = useDispatch() | ||
const fidoConfiguration = useSelector((state) => state.fidoReducer) | ||
|
||
useEffect(() => { | ||
dispatch(getFidoConfiguration()) | ||
}, []) | ||
|
||
const tabToShow = (tabName) => { | ||
switch (tabName) { | ||
case 'Static Configuration': | ||
return ( | ||
<StaticConfiguration | ||
handleSubmit={handleStaticConfigurationSubmit} | ||
fidoConfiguration={fidoConfiguration} | ||
/> | ||
) | ||
case 'Dynamic Configuration': | ||
return ( | ||
<DynamicConfiguration | ||
handleSubmit={handleDyamicConfigurationSubmit} | ||
fidoConfiguration={fidoConfiguration} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
const handleDyamicConfigurationSubmit = (data) => { | ||
const apiPayload = fidoApiPayloadDynamicConfig({ data, fidoConfiguration }) | ||
dispatch(putFidoConfiguration(apiPayload)) | ||
} | ||
|
||
const handleStaticConfigurationSubmit = (data) => { | ||
const apiPayload = fidoApiPayload({ data, fidoConfiguration }) | ||
dispatch(putFidoConfiguration(apiPayload)) | ||
} | ||
|
||
return ( | ||
<React.Fragment> | ||
<GluuLoader blocking={fidoConfiguration?.loading}> | ||
<Card className='mb-3' style={applicationStyle.mainCard}> | ||
<CardBody> | ||
{!fidoConfiguration?.loading && ( | ||
<GluuTabs tabNames={tabNames} tabToShow={tabToShow} /> | ||
)} | ||
</CardBody> | ||
</Card> | ||
</GluuLoader> | ||
</React.Fragment> | ||
) | ||
} |
Oops, something went wrong.