From b721cd775a9126d2e4c3fb59bc2fb1a845f0e72d Mon Sep 17 00:00:00 2001 From: = Date: Thu, 21 Jul 2022 01:02:01 +0530 Subject: [PATCH] fix(admin-ui): gentle push --- admin-ui/app/locales/en/translation.json | 48 +-- .../Clients/ClientCibaParUmaPanel.js | 145 +++++++ .../components/Clients/ClientLogoutPanel.js | 120 ++++++ .../components/Clients/ClientSoftwarePanel.js | 141 +++++++ .../components/Clients/ClientTokensPanel.js | 364 ++++++++++++++++++ .../components/Clients/ClientWizardForm.js | 75 ++-- 6 files changed, 846 insertions(+), 47 deletions(-) create mode 100644 admin-ui/plugins/auth-server/components/Clients/ClientCibaParUmaPanel.js create mode 100644 admin-ui/plugins/auth-server/components/Clients/ClientLogoutPanel.js create mode 100644 admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js create mode 100644 admin-ui/plugins/auth-server/components/Clients/ClientTokensPanel.js diff --git a/admin-ui/app/locales/en/translation.json b/admin-ui/app/locales/en/translation.json index 5090c9ad0..879113d2c 100644 --- a/admin-ui/app/locales/en/translation.json +++ b/admin-ui/app/locales/en/translation.json @@ -122,7 +122,7 @@ "persist_client_authorizations": "Persist Client Authorizations", "policy_uri": "Policy URI", "post_authn_scripts": "Post Authn Scripts", - "post_logout_redirect_uris": "Post Logout Redirect URIs", + "post_logout_redirect_uris": "Post logout redirect URI", "pre_authorization": "Pre-Authorization", "primary_key": "Primary Key", "programming_language": "Programming Language", @@ -173,37 +173,39 @@ "run_introspection_script_before_accesstoken": "Run Introspection Script Before AccessToken As Jwt Creation And Include Claims", "keep_client_authorization": "Keep Client Authorization After Expiration", "allow_spontaneous_scopes": "Allow Spontaneous Scopes", - "backchannelLogoutSessionRequired": "Back Channel Logout Session Required", - "backchannelLogoutUri": "Back Channel Logout URI", - "additionalAudience": "Additional Audience", - "accessTokenAsJwt": "Access Token as JWT", - "requireAuthTime": "Require AuthTime", - "rptAsJwt": "Rpt As Jwt", - "includeClaimsInIdToken": "Include Claims In IdToken", - "frontChannelLogoutSessionRequired": "Logout Session Required", + "backchannelLogoutSessionRequired": "Back channel. logout session required", + "backchannelLogoutUri": "Back channel. logout URI", + "additionalAudience": "Access token additional audiences", + "accessTokenAsJwt": "Access token type", + "requireAuthTime": "Add auth_time to id_token", + "rptAsJwt": "RPT token type", + "includeClaimsInIdToken": "Include claims in id_token", + "frontChannelLogoutSessionRequired": "Front channel. logout session required", "clientUri": "Client URI", "trusted_host": "Trusted Host ?", "initiateLoginUri": "Initiate Login URI", "tosUri": "Terms of service URI", - "idTokenTokenBindingCnf": "IdToken Binding Confirmation method", - "refreshTokenLifetime": "Refresh Token Lifetime", + "idTokenTokenBindingCnf": "Token binding confirmation method for id_token", + "refreshTokenLifetime": "Refresh token lifetime", "oxdId": "Oxd Id", - "defaultMaxAge": "Default Maximun Authentication Age", - "accessTokenLifetime": "Access Token Lifetime", + "defaultMaxAge": "Default max authn age", + "accessTokenLifetime": "Access token lifetime", "show_software_settings": "Show Software related settings ?", "show_ciba_settings": "Show CIBA related settings ?", - "backchannelTokenDeliveryMode": "CIBA Token Delivery Mode", - "backchannelClientNotificationEndpoint": "CIBA Client Notification Endpoint", - "backchannelUserCodeParameter": "CIBA User Code Parameter?", - "frontChannelLogoutUri": "Front Channel Logout URI", + "backchannelTokenDeliveryMode": "Token delivery method", + "backchannelClientNotificationEndpoint": "Client notification endpoint ", + "backchannelUserCodeParameter": "Require user code param", + "frontChannelLogoutUri": "Front channel. logout URI", "contacts": "Contacts", - "claimRedirectURIs": "Claim Redirect URIs", + "claimRedirectURIs": "Claims redirect URI", + "parLifetime": "Require lifetime", + "requirePar": "Require PAR", "requestUris": "Request URIs", - "authorizedOrigins": "Authorized Javascript Origins", + "authorizedOrigins": "Authorized JS origins", "defaultAcrValues": "Default Acr Values", - "softwareId": "Software Id", - "softwareVersion": "Software Version", - "softwareStatement": "'Software Statement", + "softwareId": "Software id", + "softwareVersion": "Software version", + "softwareStatement": "Software statement", "usage_type": "Usage Type", "script_path": "Script Path", "use_anonymous_bind": "Use Anonymous Bind", @@ -729,7 +731,7 @@ "frontChannelLogoutUri": "The front channel logout Uri", "backchannelLogoutUri": "The back channel logout Uri", "additionalAudience": "The client audiences", - "runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims": "Run Introspection Script Before AccessToken As Jwt Creation And Include Claims", + "runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims": "Run introspection script before JWT access token", "keepClientAuthorizationAfterExpiration": "Keep Client Authorization After Expiration", "allowSpontaneousScopes": "Allow Spontaneous Scopes", "backchannelLogoutSessionRequired": "Back channel Logout Session Required", diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientCibaParUmaPanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientCibaParUmaPanel.js new file mode 100644 index 000000000..107e118c6 --- /dev/null +++ b/admin-ui/plugins/auth-server/components/Clients/ClientCibaParUmaPanel.js @@ -0,0 +1,145 @@ +import React, { useState } from 'react' +import { Col, Container, FormGroup } from 'Components' +import GluuLabel from 'Routes/Apps/Gluu/GluuLabel' +import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn' +import GluuSelectRow from 'Routes/Apps/Gluu/GluuSelectRow' +import GluuToogleRow from 'Routes/Apps/Gluu/GluuToogleRow' +import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow' +import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd' +import Toggle from 'react-toggle' +import { useTranslation } from 'react-i18next' +import { FormControlLabel, Radio, RadioGroup } from '@material-ui/core' +const DOC_CATEGORY = 'openid_client' + +function ClientCibaParUmaPanel({ client, scripts, formik }) { + const { t } = useTranslation() + const claim_uri_id = 'claim_uri_id' + const request_uri_id = 'request_uri_id' + const origin_uri_id = 'origin_uri_id' + const contact_uri_id = 'contact_uri_id' + const cibaDeliveryModes = ['poll', 'push', 'ping'] + const contacts = [] + const claimRedirectURI = [] + const requestUris = [] + const authorizedOrigins = [] + scripts = scripts + .filter((item) => item.scriptType == 'PERSON_AUTHENTICATION') + .filter((item) => item.enabled) + .map((item) => ({ dn: item.dn, name: item.name })) + function uriValidator(uri) { + return uri + } + function getMapping(partial, total) { + if (!partial) { + partial = [] + } + return total.filter((item) => partial.includes(item.dn)) + } + const [softwareSection, setSoftwareSection] = useState(false) + const [cibaSection, setCibaSection] = useState(false) + + function handleCibaSection() { + setCibaSection(!cibaSection) + } + function handleSoftwareSection() { + setSoftwareSection(!softwareSection) + } + function emailValidator(email) { + return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test( + email, + ) + } + return ( + +

CIBA

+ + + + +

PAR

+ + +

UMA

+ + + + { + formik.setFieldValue('rptAsJwt', e.target.value == 'true') + }} + > + } + label="JWT" + checked={client.rptAsJwt == true} + /> + } + label="Reference" + checked={client.rptAsJwt == false} + /> + + + + {/* */} + + +
+ ) +} + +export default ClientCibaParUmaPanel diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientLogoutPanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientLogoutPanel.js new file mode 100644 index 000000000..8c8c66a8f --- /dev/null +++ b/admin-ui/plugins/auth-server/components/Clients/ClientLogoutPanel.js @@ -0,0 +1,120 @@ +import React, { useState } from 'react' +import { Col, Container, FormGroup } from 'Components' +import GluuLabel from 'Routes/Apps/Gluu/GluuLabel' +import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn' +import GluuSelectRow from 'Routes/Apps/Gluu/GluuSelectRow' +import GluuToogleRow from 'Routes/Apps/Gluu/GluuToogleRow' +import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow' +import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd' +import GluuBooleanSelectBox from 'Routes/Apps/Gluu/GluuBooleanSelectBox' +import Toggle from 'react-toggle' +import { useTranslation } from 'react-i18next' +const DOC_CATEGORY = 'openid_client' + +function ClientLogoutPanel({ client, scripts, formik }) { + const { t } = useTranslation() + const claim_uri_id = 'claim_uri_id' + const request_uri_id = 'request_uri_id' + const origin_uri_id = 'origin_uri_id' + const contact_uri_id = 'contact_uri_id' + const cibaDeliveryModes = ['poll', 'push', 'ping'] + const contacts = [] + const claimRedirectURI = [] + const requestUris = [] + const authorizedOrigins = [] + scripts = scripts + .filter((item) => item.scriptType == 'PERSON_AUTHENTICATION') + .filter((item) => item.enabled) + .map((item) => ({ dn: item.dn, name: item.name })) + function uriValidator(uri) { + return uri + } + function getMapping(partial, total) { + if (!partial) { + partial = [] + } + return total.filter((item) => partial.includes(item.dn)) + } + const [softwareSection, setSoftwareSection] = useState(false) + const [cibaSection, setCibaSection] = useState(false) + + function handleCibaSection() { + setCibaSection(!cibaSection) + } + function handleSoftwareSection() { + setSoftwareSection(!softwareSection) + } + function emailValidator(email) { + return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test( + email, + ) + } + + const postLogoutRedirectUris = [] + function postUriValidator(uri) { + return uri + } + const post_uri_id = 'post_uri_id' + + const backchannelLogoutUris = [] + function uriValidator(uri) { + return uri + } + const backchannel_uri_id = 'backchannel_uri_id' + + return ( + + + + + + + + + + ) +} + +export default ClientLogoutPanel diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js new file mode 100644 index 000000000..eb1a0b6f5 --- /dev/null +++ b/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js @@ -0,0 +1,141 @@ +import React, { useState } from 'react' +import { Col, Container, FormGroup } from 'Components' +import GluuLabel from 'Routes/Apps/Gluu/GluuLabel' +import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn' +import GluuSelectRow from 'Routes/Apps/Gluu/GluuSelectRow' +import GluuToogleRow from 'Routes/Apps/Gluu/GluuToogleRow' +import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow' +import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd' +import Toggle from 'react-toggle' +import { useTranslation } from 'react-i18next' +const DOC_CATEGORY = 'openid_client' + +function ClientSoftwarePanel({ client, scripts, formik }) { + const { t } = useTranslation() + const claim_uri_id = 'claim_uri_id' + const request_uri_id = 'request_uri_id' + const origin_uri_id = 'origin_uri_id' + const contact_uri_id = 'contact_uri_id' + const cibaDeliveryModes = ['poll', 'push', 'ping'] + const contacts = [] + const claimRedirectURI = [] + const requestUris = [] + const authorizedOrigins = [] + scripts = scripts + .filter((item) => item.scriptType == 'PERSON_AUTHENTICATION') + .filter((item) => item.enabled) + .map((item) => ({ dn: item.dn, name: item.name })) + function uriValidator(uri) { + return uri + } + function getMapping(partial, total) { + if (!partial) { + partial = [] + } + return total.filter((item) => partial.includes(item.dn)) + } + const [softwareSection, setSoftwareSection] = useState(false) + const [cibaSection, setCibaSection] = useState(false) + + function handleCibaSection() { + setCibaSection(!cibaSection) + } + function handleSoftwareSection() { + setSoftwareSection(!softwareSection) + } + function emailValidator(email) { + return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test( + email, + ) + } + return ( + + + + + + + + {/* + + + + + */} + + + + + + + + ) +} + +export default ClientSoftwarePanel diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientTokensPanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientTokensPanel.js new file mode 100644 index 000000000..b7f5b30a9 --- /dev/null +++ b/admin-ui/plugins/auth-server/components/Clients/ClientTokensPanel.js @@ -0,0 +1,364 @@ +import React, { useState } from 'react' +import { Col, Container, FormGroup } from 'Components' +import GluuLabel from 'Routes/Apps/Gluu/GluuLabel' +import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn' +import GluuSelectRow from 'Routes/Apps/Gluu/GluuSelectRow' +import GluuToogleRow from 'Routes/Apps/Gluu/GluuToogleRow' +import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow' +import GluuBooleanSelectBox from 'Routes/Apps/Gluu/GluuBooleanSelectBox' +import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd' +import Toggle from 'react-toggle' +import { useTranslation } from 'react-i18next' +import { FormControlLabel, Radio, RadioGroup } from '@material-ui/core' +const DOC_CATEGORY = 'openid_client' + +function ClientTokensPanel({ client, scripts, formik }) { + const { t } = useTranslation() + const claim_uri_id = 'claim_uri_id' + const request_uri_id = 'request_uri_id' + const origin_uri_id = 'origin_uri_id' + const contact_uri_id = 'contact_uri_id' + const cibaDeliveryModes = ['poll', 'push', 'ping'] + const contacts = [] + const claimRedirectURI = [] + const requestUris = [] + const authorizedOrigins = [] + const additionalAudiences = [] + function audienceValidator(aud) { + return aud + } + const audience_id = 'audience_id' + + scripts = scripts + .filter((item) => item.scriptType == 'PERSON_AUTHENTICATION') + .filter((item) => item.enabled) + .map((item) => ({ dn: item.dn, name: item.name })) + function uriValidator(uri) { + return uri + } + function getMapping(partial, total) { + if (!partial) { + partial = [] + } + return total.filter((item) => partial.includes(item.dn)) + } + const [softwareSection, setSoftwareSection] = useState(false) + const [cibaSection, setCibaSection] = useState(false) + + function handleCibaSection() { + setCibaSection(!cibaSection) + } + function handleSoftwareSection() { + setSoftwareSection(!softwareSection) + } + function emailValidator(email) { + return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test( + email, + ) + } + return ( + + + + + + + { + formik.setFieldValue( + 'accessTokenAsJwt', + e.target.value == 'true', + ) + }} + > + } + label="JWT" + checked={client.accessTokenAsJwt == true} + /> + } + label="Reference" + checked={client.accessTokenAsJwt == false} + /> + + + + {/* */} + + + + + + + + + {/* + + */} + + + + {/* + + */} + + {/* */} + {/* */} + {/* */} + + + + + + + + + {/* + + + */} + + {/* {client.softwareSection && ( + + )} + {client.softwareSection && ( + + )} + {client.softwareSection && ( + + )} */} + {/* + + + + + */} + {/* {client.cibaSection && ( + + )} + {client.cibaSection && ( + + )} + {client.cibaSection && ( + + )} */} + {/* */} + {/* */} + {/* */} + {/* */} + {' '} + {/* */} + {/* */} + + ) +} + +export default ClientTokensPanel diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js b/admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js index 86a70e958..daf84b948 100644 --- a/admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js +++ b/admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js @@ -11,13 +11,20 @@ import { useTranslation } from 'react-i18next' import { hasPermission, CLIENT_WRITE } from 'Utils/PermChecker' import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle' import { ThemeContext } from 'Context/theme/themeContext' +import ClientTokensPanel from './ClientTokensPanel' +import ClientLogoutPanel from './ClientLogoutPanel' +import ClientSoftwarePanel from './ClientSoftwarePanel' +import ClientCibaParUmaPanel from './ClientCibaParUmaPanel' const sequence = [ 'Basic', - 'Advanced', - 'EncryptionSigning', - 'ClientAttributes', - 'CustomScripts', + 'Tokens', + 'Logout', + 'SoftwareInfo', + 'CIBA/PAR/UMA', + 'Encryption/Signing', + 'AdvancedClientProperties', + 'ClientScripts', ] const ATTRIBUTE = 'attributes' const DESCRIPTION = 'description' @@ -236,44 +243,44 @@ function ClientWizardForm({ {t('titles.client_basic')} } - complete={isComplete(sequence[0])} + complete={isComplete(sequence[1])} > {t('titles.token')} } - complete={isComplete(sequence[0])} + complete={isComplete(sequence[2])} > {t('titles.log_out')} } - complete={isComplete(sequence[0])} + complete={isComplete(sequence[3])} > {t('titles.software_info')} } - complete={isComplete(sequence[0])} + complete={isComplete(sequence[4])} > {t('titles.CIBA_PAR_UMA')} } - complete={isComplete(sequence[0])} + complete={isComplete(sequence[5])} > {t('titles.encryption_signing')} } - complete={isComplete(sequence[1])} + complete={isComplete(sequence[6])} > {t('titles.client_advanced')} @@ -292,9 +299,9 @@ function ClientWizardForm({ {t('titles.client_attributes')} */} } - complete={isComplete(sequence[4])} + complete={isComplete(sequence[7])} > {t('titles.client_scripts')} @@ -329,11 +336,16 @@ function ClientWizardForm({ : {} } > - + {/* */} ) case sequence[2]: @@ -345,11 +357,16 @@ function ClientWizardForm({ : {} } > - + {/* */} ) case sequence[3]: @@ -361,7 +378,12 @@ function ClientWizardForm({ : {} } > - + + {/* */} ) case sequence[4]: @@ -373,12 +395,17 @@ function ClientWizardForm({ : {} } > - + {/* + /> */} ) }