Skip to content

Commit

Permalink
fix(admin-ui): final push for clients redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Jul 22, 2022
1 parent 4c406f0 commit 636923d
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next'
import DatePicker from 'react-datepicker'
const DOC_CATEGORY = 'openid_client'

function ClientAdvancedPanel({ client, scripts, formik }) {
function ClientAdvancedPanel({ client, scripts, formik, scopes }) {
const { t } = useTranslation()
const request_uri_id = 'request_uri_id'
const requestUris = []
Expand Down Expand Up @@ -49,6 +49,12 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
email,
)
}
function getScopeMapping(exitingScopes, scopes) {
if (!exitingScopes) {
exitingScopes = []
}
return scopes.filter((item) => exitingScopes.includes(item.dn))
}
return (
<Container>
<FormGroup row>
Expand Down Expand Up @@ -94,13 +100,15 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
rsize={4}
doc_category={DOC_CATEGORY}
/>
<GluuInputRow
label="fields.spontaneousScopes"
<GluuTypeAheadForDn
name="spontaneousScopes"
label="fields.spontaneousScopes"
formik={formik}
value={client.spontaneousScopes}
value={getScopeMapping(client.spontaneousScopes, scopes)}
options={scopes}
doc_category={DOC_CATEGORY}
/>
></GluuTypeAheadForDn>

<GluuInputRow
label="fields.initiateLoginUri"
name="initiateLoginUri"
Expand All @@ -127,17 +135,20 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
options={scripts}
doc_category={DOC_CATEGORY}
></GluuTypeAheadForDn>
<GluuInputRow
label="fields.authorizedAcrValues"
<GluuTypeAheadForDn
name="authorizedAcrValues"
label="fields.authorizedAcrValues"
formik={formik}
value={client.authorizedAcrValues}
value={getMapping(client.authorizedAcrValues, scripts)}
options={scripts}
doc_category={DOC_CATEGORY}
/>
<GluuInputRow
label="fields.defaultPromptLogin"
></GluuTypeAheadForDn>
<GluuToogleRow
name="defaultPromptLogin"
lsize={9}
rsize={3}
formik={formik}
label="fields.defaultPromptLogin"
value={client.defaultPromptLogin}
doc_category={DOC_CATEGORY}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ function ClientScriptPanel({ client, scopes, scripts, formik }) {
.filter((item) => item.scriptType == 'UMA_RPT_CLAIMS')
.filter((item) => item.enabled)
.map((item) => ({ dn: item.dn, name: item.name }))
const ropcScripts = scripts
.filter((item) => item.scriptType == 'RESOURCE_OWNER_PASSWORD_CREDENTIALS')
.filter((item) => item.enabled)
.map((item) => ({ dn: item.dn, name: item.name }))
const updateTokenScriptDns = scripts
.filter((item) => item.scriptType == 'UPDATE_TOKEN')
.filter((item) => item.enabled)
.map((item) => ({ dn: item.dn, name: item.name }))

return (
<Container>
Expand All @@ -40,15 +48,14 @@ function ClientScriptPanel({ client, scopes, scripts, formik }) {
options={scopes}
doc_category={DOC_CATEGORY}
></GluuTypeAheadForDn>
<GluuInputRow
label="fields.updateTokenScriptDns"
<GluuTypeAheadForDn
name="updateTokenScriptDns"
label="fields.updateTokenScriptDns"
formik={formik}
value={client.updateTokenScriptDns}
options={updateTokenScriptDns}
doc_category={DOC_CATEGORY}
lsize={4}
rsize={8}
/>
></GluuTypeAheadForDn>
<GluuTypeAheadForDn
name="postAuthnScripts"
label="fields.post_authn_scripts"
Expand All @@ -65,15 +72,14 @@ function ClientScriptPanel({ client, scopes, scripts, formik }) {
options={instrospectionScripts}
doc_category={DOC_CATEGORY}
></GluuTypeAheadForDn>
<GluuInputRow
label="fields.ropcScripts"
<GluuTypeAheadForDn
name="ropcScripts"
label="fields.ropcScripts"
formik={formik}
value={client.ropcScripts}
options={ropcScripts}
doc_category={DOC_CATEGORY}
lsize={4}
rsize={8}
/>
></GluuTypeAheadForDn>
<GluuTypeAheadForDn
name="consentGatheringScripts"
label="fields.consent_gathering_scripts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,23 @@ function ClientWizardForm({
spontaneousScopeScriptDns:
client.attributes.spontaneousScopeScriptDns || [],
consentGatheringScripts: client.attributes.consentGatheringScripts || [],
redirectUrisRegex: client.attributes.redirectUrisRegex || '',
parLifetime: client.attributes.parLifetime || '',
requirePar: client.attributes.requirePar || false,
updateTokenScriptDns: client.attributes.updateTokenScriptDns || [],
ropcScripts: client.attributes.ropcScripts || [],
authorizationSignedResponseAlg:
client.attributes.authorizationSignedResponseAlg || '',
authorizationEncryptedResponseAlg:
client.attributes.authorizationEncryptedResponseAlg || '',
authorizationEncryptedResponseEnc:
client.attributes.authorizationEncryptedResponseEnc || '',
postAuthnScripts: client.attributes.postAuthnScripts || [],
rptClaimsScripts: client.attributes.rptClaimsScripts || [],
additionalAudience: client.attributes.additionalAudience,
backchannelLogoutUri: client.attributes.backchannelLogoutUri,
defaultPromptLogin: client.attributes.defaultPromptLogin || false,
authorizedAcrValues: client.attributes.authorizedAcrValues || [],
customObjectClasses: client.customObjectClasses || [],
requireAuthTime: client.requireAuthTime,
trustedClient: client.trustedClient,
Expand Down Expand Up @@ -226,6 +239,19 @@ function ClientWizardForm({
values[ATTRIBUTE].backchannelLogoutUri = values.backchannelLogoutUri
values[ATTRIBUTE].postAuthnScripts = values.postAuthnScripts
values[ATTRIBUTE].additionalAudience = values.additionalAudience
values[ATTRIBUTE].redirectUrisRegex = values.redirectUrisRegex
values[ATTRIBUTE].parLifetime = values.parLifetime
values[ATTRIBUTE].requirePar = values.requirePar
values[ATTRIBUTE].defaultPromptLogin = values.defaultPromptLogin
values[ATTRIBUTE].authorizedAcrValues = values.authorizedAcrValues
values[ATTRIBUTE].updateTokenScriptDns = values.updateTokenScriptDns
values[ATTRIBUTE].ropcScripts = values.ropcScripts
values[ATTRIBUTE].authorizationSignedResponseAlg =
values.authorizationSignedResponseAlg
values[ATTRIBUTE].authorizationEncryptedResponseAlg =
values.authorizationEncryptedResponseAlg
values[ATTRIBUTE].authorizationEncryptedResponseEnc =
values.authorizationEncryptedResponseEnc
customOnSubmit(JSON.parse(JSON.stringify(values)))
}}
>
Expand Down Expand Up @@ -443,6 +469,7 @@ function ClientWizardForm({
client={client}
scripts={scripts}
formik={formik}
scopes={scopes}
/>
</div>
)
Expand Down

0 comments on commit 636923d

Please sign in to comment.