diff --git a/admin-ui/app/locales/en/translation.json b/admin-ui/app/locales/en/translation.json index cf01c701b..da53e5587 100644 --- a/admin-ui/app/locales/en/translation.json +++ b/admin-ui/app/locales/en/translation.json @@ -169,6 +169,9 @@ "saml1_uri": "Saml1 URI", "saml2_uri": "Saml2 URI", "scope_type": "Scope type", + "umaAuthorizationPolicies": "Authorization Policies", + "umaResourcesScript": "Associated Clients", + "iconUrl": "Icon URL", "scopes:": "Scopes", "scripts": "Scripts", "script_type": "Script Type", @@ -405,7 +408,8 @@ "sql_passwordEncryptionMethod": "Add password encryption method.", "sql_serverTimezone": "Enter server timezone.", "activate_sql_configuration": "Activate SQL configuration.", - "script_path": "Enter script file path" + "script_path": "Enter script file path", + "iconUrl": "Icon URL" }, "titles": { "acrs": "ACRs", diff --git a/admin-ui/app/routes/Apps/Gluu/GluuTypeAheadForDn.js b/admin-ui/app/routes/Apps/Gluu/GluuTypeAheadForDn.js index 972597b71..d77505bce 100644 --- a/admin-ui/app/routes/Apps/Gluu/GluuTypeAheadForDn.js +++ b/admin-ui/app/routes/Apps/Gluu/GluuTypeAheadForDn.js @@ -24,6 +24,7 @@ function GluuTypeAheadForDn({ required, doc_category, doc_entry, + disabled = false, allowNew = false, lsize = 4, rsize = 8, @@ -48,6 +49,7 @@ function GluuTypeAheadForDn({ ), ) }} + disabled={disabled} id={name} data-testid={name} name={name} diff --git a/admin-ui/plugins/auth-server/components/Scopes/ScopeForm.js b/admin-ui/plugins/auth-server/components/Scopes/ScopeForm.js index 94a5a8a6d..ce6302255 100644 --- a/admin-ui/plugins/auth-server/components/Scopes/ScopeForm.js +++ b/admin-ui/plugins/auth-server/components/Scopes/ScopeForm.js @@ -31,20 +31,23 @@ import GluuTooltip from 'Routes/Apps/Gluu/GluuTooltip' import { SCOPE } from 'Utils/ApiResources' import { useTranslation } from 'react-i18next' import { ThemeContext } from 'Context/theme/themeContext' -import { - LIMIT, - PATTERN, -} from 'Plugins/auth-server/common/Constants' +import { LIMIT, PATTERN } from 'Plugins/auth-server/common/Constants' +import { getUMAResources } from '../../redux/actions/ScopeActions' -function ScopeForm({ scope, scripts, attributes, handleSubmit}) { +function ScopeForm({ scope, scripts, attributes, handleSubmit }) { const { t } = useTranslation() let dynamicScopeScripts = [] + let umaResourcesScript = [] + let umaAuthorizationPolicies = [] + const theme = useContext(ThemeContext) const selectedTheme = theme.state.theme const history = useHistory() const spontaneousClientScopes = scope.attributes.spontaneousClientScopes || [] - const dispatch = useDispatch() - const client = useSelector((state) => state.oidcReducer.items) + const dispatch = useDispatch() + const client = useSelector((state) => state.oidcReducer.items) + const umaResources = useSelector((state) => state.scopeReducer.umaResources) + // const scripts = useSelector((state) => state.customScriptReducer.items) let claims = [] scripts = scripts || [] attributes = attributes || [] @@ -52,17 +55,43 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit}) { .filter((item) => item.scriptType == 'DYNAMIC_SCOPE') .filter((item) => item.enabled) .map((item) => ({ dn: item.dn, name: item.name })) + + umaAuthorizationPolicies = scripts + .filter((item) => item.scriptType == 'UMA_RPT_POLICY') + .filter((item) => item.enabled) + .map((item) => ({ dn: item.dn, name: item.name })) + + umaResourcesScript = umaResources.map((item) => ({ + dn: item.dn, + name: item.id, + })) + + useEffect(() => { + dispatch(getUMAResources({ pattern: 'scope' })) + }, []) + claims = attributes.map((item) => ({ dn: item.dn, name: item.displayName })) const [init, setInit] = useState(false) const [modal, setModal] = useState(false) - const [showClaimsPanel, handleClaimsPanel] = useState(scope.scopeType === 'openid') - const [showDynamicPanel, handleDynamicPanel] = useState(scope.scopeType === 'dynamic') - const [showSpontaneousPanel, handleShowSpontaneousPanel] = useState(scope.scopeType === 'spontaneous') + const [showClaimsPanel, handleClaimsPanel] = useState( + scope.scopeType === 'openid', + ) + const [showDynamicPanel, handleDynamicPanel] = useState( + scope.scopeType === 'dynamic', + ) + const [showSpontaneousPanel, handleShowSpontaneousPanel] = useState( + scope.scopeType === 'spontaneous', + ) + const [showUmaPanel, handleShowUmaPanel] = useState(scope.scopeType === 'UMA') useEffect(() => { if (showSpontaneousPanel) { - dispatch(searchClients({ "action_data": makeOptions(1, scope.attributes.spontaneousClientId) })) + dispatch( + searchClients({ + action_data: makeOptions(1, scope.attributes.spontaneousClientId), + }), + ) } }, [showClaimsPanel]) @@ -89,6 +118,11 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit}) { } else { handleShowSpontaneousPanel(false) } + if (type && type === 'UMA') { + handleShowUmaPanel(true) + } else { + handleShowUmaPanel(false) + } scope.dynamicScopeScripts = '' scope.claims = '' scope.attributes.spontaneousClientId = '' @@ -143,9 +177,7 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit}) { displayName: Yup.string() .min(2, 'displayName 2 characters') .required('Required!'), - id: Yup.string() - .min(2, 'id 2 characters') - .required('Required!'), + id: Yup.string().min(2, 'id 2 characters').required('Required!'), })} onSubmit={(values) => { const result = Object.assign(scope, values) @@ -162,7 +194,6 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit}) { > {(formik) => (