-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
518 additions
and
107 deletions.
There are no files selected for viewing
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 |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| export const API_BASE_PATH = 'api'; | ||
|
|
||
| export const FILTER_PLUGIN_TYPES = ['RequiredValidUntil', 'SignatureValidation', 'EntityRoleWhiteList']; | ||
|
|
||
|
|
||
|
|
||
| export default API_BASE_PATH; |
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,11 @@ | ||
| export function isValidRegex(pattern) { | ||
| if (!pattern) { | ||
| return false; | ||
| } | ||
| try { | ||
| new RegExp(pattern); | ||
| } catch (err) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; |
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,23 @@ | ||
| export function checkByType(value) { | ||
| switch (typeof value) { | ||
| case 'object': { | ||
| return Object.keys(value).filter(k => !!value[k]).length > 0; | ||
| } | ||
| default: { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export function removeNull(attribute, discardObjects = false) { | ||
| if (!attribute) { return {}; } | ||
| let removed = Object.keys(attribute).reduce((coll, val, index) => { | ||
| if (attribute[val] !== null) { | ||
| if (!discardObjects || checkByType(attribute[val])) { | ||
| coll[val] = attribute[val]; | ||
| } | ||
| } | ||
| return coll; | ||
| }, {}); | ||
| return removed; | ||
| } |
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
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
109 changes: 109 additions & 0 deletions
109
ui/src/app/metadata/domain/filter/EntityAttributesFilterDefinition.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| import API_BASE_PATH from "../../../App.constant"; | ||
|
|
||
| import {removeNull} from '../../../core/utility/remove_null'; | ||
| import { isValidRegex } from '../../../core/utility/is_valid_regex'; | ||
|
|
||
| export const EntityAttributesFilterWizard= { | ||
| label: 'EntityAttributes', | ||
| type: 'EntityAttributes', | ||
| schema: `${API_BASE_PATH}/ui/EntityAttributesFilters`, | ||
| //validatorParams: [getFilterNames], | ||
| getValidators(namesList) { | ||
| const validators = { | ||
| '/': (value, property, form_current) => { | ||
| let errors; | ||
| // iterate all customer | ||
| Object.keys(value).forEach((key) => { | ||
| const item = value[key]; | ||
| const validatorKey = `/${key}`; | ||
| const validator = validators.hasOwnProperty(validatorKey) ? validators[validatorKey] : null; | ||
| const error = validator ? validator(item, { path: `/${key}` }, form_current) : null; | ||
| if (error && error.invalidate) { | ||
| errors = errors || []; | ||
| errors.push(error); | ||
| } | ||
| }); | ||
| return errors; | ||
| }, | ||
| '/name': (value, property, form) => { | ||
| const err = namesList.indexOf(value) > -1 ? { | ||
| code: 'INVALID_NAME', | ||
| path: `#${property.path}`, | ||
| message: 'message.name-must-be-unique', | ||
| params: [value], | ||
| invalidate: true | ||
| } : null; | ||
| return err; | ||
| }, | ||
| '/relyingPartyOverrides': (value, property, form) => { | ||
| if (!value.signAssertion && value.dontSignResponse) { | ||
| return { | ||
| code: 'INVALID_SIGNING', | ||
| path: `#${property.path}`, | ||
| message: 'message.invalid-signing', | ||
| params: [value], | ||
| invalidate: false | ||
| }; | ||
| } | ||
| return null; | ||
| }, | ||
| '/entityAttributesFilterTarget': (value, property, form) => { | ||
| if (!form || !form.value || !form.value.entityAttributesFilterTarget || | ||
| form.value.entityAttributesFilterTarget.entityAttributesFilterTargetType !== 'REGEX') { | ||
| return null; | ||
| } | ||
| return isValidRegex(value.value[0]) ? null : { | ||
| code: 'INVALID_REGEX', | ||
| path: `#${property.path}`, | ||
| message: 'message.invalid-regex-pattern', | ||
| params: [value.value[0]], | ||
| invalidate: true | ||
| }; | ||
| }, | ||
| }; | ||
| return validators; | ||
| }, | ||
| parser: (changes) => { | ||
| return { | ||
| ...changes, | ||
| relyingPartyOverrides: removeNull(changes) | ||
| }; | ||
| }, | ||
| formatter: (changes) => changes | ||
| }; | ||
|
|
||
|
|
||
| export const EntityAttributesFilterEditor= { | ||
| ...EntityAttributesFilterWizard, | ||
| steps: [ | ||
| { | ||
| id: 'common', | ||
| label: 'label.target', | ||
| index: 1, | ||
| fields: [ | ||
| 'name', | ||
| '@type', | ||
| 'resourceId', | ||
| 'filterEnabled', | ||
| 'entityAttributesFilterTarget' | ||
| ] | ||
| }, | ||
| { | ||
| id: 'options', | ||
| label: 'label.options', | ||
| index: 2, | ||
| initialValues: [], | ||
| fields: [ | ||
| 'relyingPartyOverrides' | ||
| ] | ||
| }, | ||
| { | ||
| id: 'attributes', | ||
| label: 'label.attributes', | ||
| index: 3, | ||
| fields: [ | ||
| 'attributeRelease' | ||
| ] | ||
| } | ||
| ] | ||
| }; |
81 changes: 81 additions & 0 deletions
81
ui/src/app/metadata/domain/filter/NameIdFilterDefinition.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import API_BASE_PATH from "../../../App.constant"; | ||
| import { isValidRegex } from "../../../core/utility/is_valid_regex"; | ||
|
|
||
| export const NameIDFilterWizard = { | ||
| label: 'NameIDFormat', | ||
| type: 'NameIDFormat', | ||
| schema: `${API_BASE_PATH}/ui/NameIdFormatFilter`, | ||
| steps: [], | ||
| //validatorParams: [getFilterNames], | ||
| getValidators(namesList) { | ||
| const validators = { | ||
| '/': (value, property, form_current) => { | ||
| let errors; | ||
| // iterate all customer | ||
| Object.keys(value).forEach((key) => { | ||
| const item = value[key]; | ||
| const validatorKey = `/${key}`; | ||
| const validator = validators.hasOwnProperty(validatorKey) ? validators[validatorKey] : null; | ||
| const error = validator ? validator(item, { path: `/${key}` }, form_current) : null; | ||
| if (error) { | ||
| errors = errors || []; | ||
| errors.push(error); | ||
| } | ||
| }); | ||
| return errors; | ||
| }, | ||
| '/name': (value, property, form) => { | ||
| const err = namesList.indexOf(value) > -1 ? { | ||
| code: 'INVALID_NAME', | ||
| path: `#${property.path}`, | ||
| message: 'message.name-must-be-unique', | ||
| params: [value] | ||
| } : null; | ||
| return err; | ||
| }, | ||
| '/nameIdFormatFilterTarget': (value, property, form) => { | ||
| if (!form || !form.value || !form.value.nameIdFormatFilterTarget || | ||
| form.value.nameIdFormatFilterTarget.nameIdFormatFilterTargetType !== 'REGEX') { | ||
| return null; | ||
| } | ||
| return isValidRegex(value.value[0]) ? null : { | ||
| code: 'INVALID_REGEX', | ||
| path: `#${property.path}`, | ||
| message: 'message.invalid-regex-pattern', | ||
| params: [value.value[0]] | ||
| }; | ||
| } | ||
| }; | ||
| return validators; | ||
| }, | ||
| parser: (changes) => changes, | ||
| formatter: (changes) => changes | ||
| }; | ||
|
|
||
| export const NameIDFilterEditor = { | ||
| ...NameIDFilterWizard, | ||
| steps: [ | ||
| { | ||
| id: 'common', | ||
| label: 'label.target', | ||
| index: 1, | ||
| fields: [ | ||
| 'name', | ||
| 'filterEnabled', | ||
| '@type', | ||
| 'resourceId', | ||
| 'nameIdFormatFilterTarget' | ||
| ] | ||
| }, | ||
| { | ||
| id: 'options', | ||
| label: 'label.options', | ||
| index: 1, | ||
| initialValues: [], | ||
| fields: [ | ||
| 'removeExistingFormats', | ||
| 'formats' | ||
| ] | ||
| } | ||
| ] | ||
| }; |
Empty file.
Oops, something went wrong.