Skip to content

Commit

Permalink
fix: fields value not set to state
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Mar 15, 2022
1 parent 0903b91 commit 0b2df8e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
const contacts = []
const claimRedirectURI = []
const requestUris = []
const authorizedOrigins = client.authorizedOrigins || []
const authorizedOrigins = []
scripts = scripts
.filter((item) => item.scriptType == 'PERSON_AUTHENTICATION')
.filter((item) => item.enabled)
Expand Down Expand Up @@ -167,12 +167,13 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
<GluuLabel label="fields.show_software_settings" size={6} />
<Col sm={2}>
<Toggle
defaultChecked={softwareSection}
onChange={handleSoftwareSection}
name="softwareSection"
defaultChecked={client.softwareSection}
onChange={formik.handleChange}
/>
</Col>
</FormGroup>
{softwareSection && (
{client.softwareSection && (
<GluuInputRow
label="fields.softwareId"
name="softwareId"
Expand All @@ -181,7 +182,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
doc_category={DOC_CATEGORY}
/>
)}
{softwareSection && (
{client.softwareSection && (
<GluuInputRow
label="fields.softwareVersion"
name="softwareVersion"
Expand All @@ -190,7 +191,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
doc_category={DOC_CATEGORY}
/>
)}
{softwareSection && (
{client.softwareSection && (
<GluuInputRow
label="fields.softwareStatement"
name="softwareStatement"
Expand All @@ -202,10 +203,14 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
<FormGroup row>
<GluuLabel label="fields.show_ciba_settings" size={6} />
<Col sm={6}>
<Toggle defaultChecked={cibaSection} onChange={handleCibaSection} />
<Toggle
name="cibaSection"
defaultChecked={client.cibaSection}
onChange={formik.handleChange}
/>
</Col>
</FormGroup>
{cibaSection && (
{client.cibaSection && (
<GluuSelectRow
name="backchannelTokenDeliveryMode"
label="fields.backchannelTokenDeliveryMode"
Expand All @@ -215,7 +220,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
doc_category={DOC_CATEGORY}
></GluuSelectRow>
)}
{cibaSection && (
{client.cibaSection && (
<GluuInputRow
label="fields.backchannelClientNotificationEndpoint"
name="backchannelClientNotificationEndpoint"
Expand All @@ -224,7 +229,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
doc_category={DOC_CATEGORY}
/>
)}
{cibaSection && (
{client.cibaSection && (
<GluuToogleRow
name="backchannelUserCodeParameter"
formik={formik}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ const ClientBasicPanel = ({ client, scopes, formik }) => {
name="expirable"
formik={formik}
label="fields.is_expirable_client"
value={expirable}
value={client.expirable && client.expirable.length ? true : false}
handler={handleExpirable}
doc_category={DOC_CATEGORY}
/>

{expirable && (
{client.expirable && client.expirable.length && (
<FormGroup row>
<GluuLabel label="client_expiration_date" size={5} />
<Col sm={7}>
Expand All @@ -156,12 +156,12 @@ const ClientBasicPanel = ({ client, scopes, formik }) => {
showTimeSelect
dateFormat="yyyy-MM-dd HH:mm:aa"
timeFormat="HH:mm:aa"
selected={expDate}
selected={client.expirationDate}
peekNextMonth
showMonthDropdown
showYearDropdown
dropdownMode="select"
onChange={(date) => setExpDate(date)}
onChange={(e) => formik.setFieldValue('expirationDate', e)}
/>
</Col>
</FormGroup>
Expand Down
32 changes: 18 additions & 14 deletions admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function ClientWizardForm({
}
return total.filter((item) => partial.includes(item.dn)) || []
}
client.description = extractDescription(client.customAttributes || [])
// client.description = extractDescription(client.customAttributes || [])
client.spontaneousScopes =
getMapping(client.attributes.spontaneousScopes, scopes) || []
client.introspectionScripts =
Expand All @@ -133,19 +133,19 @@ function ClientWizardForm({
getMapping(client.attributes.postAuthnScripts, postScripts) || []
client.rptClaimsScripts =
getMapping(client.attributes.rptClaimsScripts, rptScripts) || []
client.tlsClientAuthSubjectDn = client.attributes.tlsClientAuthSubjectDn
client.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims =
client.attributes
.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims ||
false
client.backchannelLogoutSessionRequired =
client.attributes.backchannelLogoutSessionRequired || false
client.keepClientAuthorizationAfterExpiration =
client.attributes.keepClientAuthorizationAfterExpiration || false
client.allowSpontaneousScopes =
client.attributes.allowSpontaneousScopes || false
client.additionalAudience = client.attributes.additionalAudience || []
client.backchannelLogoutUri = client.attributes.backchannelLogoutUri
// client.tlsClientAuthSubjectDn = client.attributes.tlsClientAuthSubjectDn
// client.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims =
// client.attributes
// .runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims ||
// false
// client.backchannelLogoutSessionRequired =
// client.attributes.backchannelLogoutSessionRequired || false
// client.keepClientAuthorizationAfterExpiration =
// client.attributes.keepClientAuthorizationAfterExpiration || false
// client.allowSpontaneousScopes =
// client.attributes.allowSpontaneousScopes || false
// client.additionalAudience = client.attributes.additionalAudience || []
// client.backchannelLogoutUri = client.attributes.backchannelLogoutUri

const initialValues = {
inum: client.inum,
Expand All @@ -164,9 +164,13 @@ function ClientWizardForm({
tosUri: client.tosUri,
jwksUri: client.jwksUri,
jwks: client.jwks,
expirable: [],
expirationDate: new Date(),
softwareStatement: client.softwareStatement,
softwareVersion: client.softwareVersion,
softwareId: client.softwareId,
softwareSection: client.softwareSection ? client.softwareSection : false,
cibaSection: client.cibaSection ? client.cibaSection : false,
idTokenSignedResponseAlg: client.idTokenSignedResponseAlg,
idTokenEncryptedResponseAlg: client.idTokenEncryptedResponseAlg,
tokenEndpointAuthMethod: client.tokenEndpointAuthMethod,
Expand Down

0 comments on commit 0b2df8e

Please sign in to comment.