From f865cda092f422aa180246448f9a1baa9a775184 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 19 Nov 2019 15:05:33 -0700 Subject: [PATCH] SHIBUI-1594 added validation for protocol support enumeration --- backend/src/main/resources/i18n/messages.properties | 12 +++++++----- .../main/resources/metadata-sources-ui-schema.json | 3 --- .../domain/model/wizards/metadata-source-base.ts | 11 +++++++++++ .../widget/datalist/datalist.component.ts | 1 - .../schema-form/widget/select/select.component.html | 3 ++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index 1c0e50f0d..6d03aafdb 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -208,8 +208,8 @@ label.service-provider-status=Metadata Source Status: label.current-metadata-sources=Current Metadata Sources label.current-metadata-providers=Current Metadata Providers label.add-a-new-metadata-provider=Add a new metadata provider -label.service-resolver-name-dashboard-display-only=Service Resolver Name (Dashboard Display Only) -label.service-resolver-entity-id=Service Resolver Entity ID +label.service-resolver-name-dashboard-display-only=Service Provider Name (Dashboard Display Only) +label.service-resolver-entity-id=Service Provider Entity ID label.add-a-new-metadata-source=Add a new metadata source - Finish Summary label.name-and-entityid=Name and Entity ID. label.finish-summary-validation=Finished! @@ -222,8 +222,8 @@ label.how-are-you-adding-the-metadata-information=How are you adding the metadat label.upload-url=Upload/URL label.or=or label.name-and-upload-url=Name and Upload Url -label.service-resolver-file=Select Resolver Metadata File -label.service-resolver-metadata-url=Service Resolver Metadata URL +label.service-resolver-file=Select Provider Metadata File +label.service-resolver-metadata-url=Service Provider Metadata URL label.search-criteria-by=Search Criteria by { displayType } label.entity-ids-added=Entity Ids Added label.ui-mdui-info=User Interface / MDUI Information @@ -445,6 +445,8 @@ message.type-required=Missing required property: Type message.match-required=Missing required property: Match message.value-required=Missing required property: Value +message.protocol-support-required=Protocol Support Enumeration is required if any NameID formats are defined. + message.conflict=Conflict message.data-version-contention=Data Version Contention message.contention-new-version=A newer version of this metadata source has been saved. Below are a list of changes. You can use your changes or their changes. @@ -463,7 +465,7 @@ message.unsaved-editor=You have not saved your changes. If you exit this screen, message.editor-invalid=All forms must be valid before changes can be saved! message.unsaved-source-1=You have not completed the wizard! Do you wish to save this information? You can finish the wizard later by clicking the \u0027Edit\u0027 message.unsaved-source-2=icon on the dashboard. -message.service-resolver-name-required=Service Resolver Name is required +message.service-resolver-name-required=Service Provider Name is required message.entity-id-required=Entity ID is required message.entity-id-must-be-unique=Entity ID must be unique message.file-upload-alert=Note: You can only import a file with a single entityID (EntityDescriptor element) in it. Anything more in that file will result in an error. diff --git a/backend/src/main/resources/metadata-sources-ui-schema.json b/backend/src/main/resources/metadata-sources-ui-schema.json index da3cc5672..9de6c9a31 100644 --- a/backend/src/main/resources/metadata-sources-ui-schema.json +++ b/backend/src/main/resources/metadata-sources-ui-schema.json @@ -149,9 +149,6 @@ }, "serviceProviderSsoDescriptor": { "type": "object", - "widget": { - "id": "fieldset" - }, "fieldsets": [ { "type": "group", diff --git a/ui/src/app/metadata/domain/model/wizards/metadata-source-base.ts b/ui/src/app/metadata/domain/model/wizards/metadata-source-base.ts index c011cad6d..557733390 100644 --- a/ui/src/app/metadata/domain/model/wizards/metadata-source-base.ts +++ b/ui/src/app/metadata/domain/model/wizards/metadata-source-base.ts @@ -105,6 +105,17 @@ export class MetadataSourceBase implements Wizard { }; } return null; + }, + '/serviceProviderSsoDescriptor': (value, property, form) => { + if (value.nameIdFormats && value.nameIdFormats.length && !value.protocolSupportEnum) { + return { + code: 'PROTOCOL_SUPPORT_ENUM_REQUIRED', + path: `#${property.path}`, + message: 'message.protocol-support-required', + params: [value] + }; + } + return null; } }; return validators; diff --git a/ui/src/app/schema-form/widget/datalist/datalist.component.ts b/ui/src/app/schema-form/widget/datalist/datalist.component.ts index 8324b2753..ce3244e6f 100644 --- a/ui/src/app/schema-form/widget/datalist/datalist.component.ts +++ b/ui/src/app/schema-form/widget/datalist/datalist.component.ts @@ -25,7 +25,6 @@ export class DatalistComponent extends ControlWidget implements AfterViewInit { } else { this.control.enable(); } - console.log(this.formProperty); } getData(query: string): void { diff --git a/ui/src/app/schema-form/widget/select/select.component.html b/ui/src/app/schema-form/widget/select/select.component.html index f8945347d..47ef81b2d 100644 --- a/ui/src/app/schema-form/widget/select/select.component.html +++ b/ui/src/app/schema-form/widget/select/select.component.html @@ -51,7 +51,8 @@ + class="form-text text-danger" + *ngIf="errorMessages && errorMessages.length"> , error