Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit b0cfc269 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Update sevice metadata generation according to parameter...

Update sevice metadata generation according to parameter identifiersBehaviour.ParticipantIdentifierScheme.ebCoreId.concatenate
parents cdb26049 34f587dd
No related branches found
No related tags found
No related merge requests found
Showing
with 70 additions and 19 deletions
......@@ -77,9 +77,9 @@
<slf4j.version>1.7.32</slf4j.version>
<soapui.plugin.version>5.1.2</soapui.plugin.version>
<spring-modules-jakarta-commons.version>0.8</spring-modules-jakarta-commons.version>
<spring.boot.version>2.6.3</spring.boot.version>
<spring.security.version>5.6.1</spring.security.version>
<spring.version>5.3.18</spring.version>
<spring.boot.version>2.6.7</spring.boot.version>
<spring.security.version>5.6.3</spring.security.version>
<spring.version>5.3.19</spring.version>
<xmlunit.version>2.5.1</xmlunit.version>
<sonar.jacoco.remotePort>${jacocoRemotePort}</sonar.jacoco.remotePort>
......
export interface SmpConfig {
smlIntegrationOn?: boolean;
smlParticipantMultiDomainOn?: boolean;
concatEBCorePartyId?: boolean;
participantSchemaRegExp?: string;
participantSchemaRegExpMessage?: string;
passwordValidationRegExp?: string;
......
<h2 mat-dialog-title>{{formTitle}}</h2>
<mat-dialog-content style="min-height:100px;width:500px">
<mat-dialog-content style="min-height:100px;width:580px">
<form [formGroup]="propertyForm">
<mat-card>
<mat-card-content>
......
......@@ -183,12 +183,32 @@ export class ServiceGroupMetadataDialogComponent implements OnInit {
});
}
getParticipantElementXML(): string {
let schema = this.dialogForm.controls['participantScheme'].value;
let value= this.dialogForm.controls['participantIdentifier'].value;
if (!!schema && this.lookups.cachedApplicationConfig.concatEBCorePartyId &&
schema.startsWith(ServiceMetadataWizardDialogComponent.EBCORE_IDENTIFIER_PREFIX) ) {
value = schema + ":" + value;
schema =null;
}
return '<ParticipantIdentifier ' +
(!schema?'': 'scheme="' + this.xmlSpecialChars(schema) + '"')+ '>'
+ this.xmlSpecialChars(value)+ '</ParticipantIdentifier>';
}
getDocumentElementXML(): string {
return ' <DocumentIdentifier ' +
(!this.dialogForm.controls['documentIdentifierScheme'].value?'': 'scheme="'
+ this.xmlSpecialChars(this.dialogForm.controls['documentIdentifierScheme'].value) + '"') +
'>' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifier'].value) + '</DocumentIdentifier>';
}
onGenerateSimpleXML() {
let exampleXML = '<ServiceMetadata xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05">' +
'\n <ServiceInformation>' +
'\n <ParticipantIdentifier scheme="' + this.xmlSpecialChars(this.dialogForm.controls['participantScheme'].value) + '">' + this.xmlSpecialChars(this.dialogForm.controls['participantIdentifier'].value) + '</ParticipantIdentifier>' +
'\n <DocumentIdentifier ' +
( !this.dialogForm.controls['documentIdentifierScheme'].value ?'': 'scheme="' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifierScheme'].value) +'"') + ' >' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifier'].value) + '</DocumentIdentifier>' +
'\n ' + this.getParticipantElementXML() +
'\n ' + this.getDocumentElementXML() +
'\n <ProcessList>' +
'\n <Process>' +
'\n <ProcessIdentifier scheme="[enterProcessType]">[enterProcessName]</ProcessIdentifier>' +
......
......@@ -6,6 +6,7 @@ import {CertificateService} from "../../user/certificate.service";
import {CertificateRo} from "../../user/certificate-ro.model";
import {AlertMessageService} from "../../common/alert-message/alert-message.service";
import {ServiceMetadataWizardRo} from "./service-metadata-wizard-edit-ro.model";
import {GlobalLookups} from "../../common/global-lookups";
@Component({
selector: 'service-metadata-wizard-dialog',
......@@ -16,6 +17,7 @@ export class ServiceMetadataWizardDialogComponent {
static readonly NEW_MODE = 'New ServiceMetadata XML';
static readonly EDIT_MODE = 'Edit ServiceMetadata XML';
static readonly EBCORE_IDENTIFIER_PREFIX = "urn:oasis:names:tc:ebcore:partyid-type:";
isNewServiceMetadata: boolean;
current: ServiceMetadataWizardRo
......@@ -32,6 +34,7 @@ export class ServiceMetadataWizardDialogComponent {
private alertService: AlertMessageService,
private dialogFormBuilder: FormBuilder,
private certificateService: CertificateService,
private lookups: GlobalLookups,
) {
this.isNewServiceMetadata = this.data.isNewServiceMetadata;
......@@ -104,8 +107,6 @@ export class ServiceMetadataWizardDialogComponent {
public getCurrent(): ServiceMetadataWizardRo {
this.current.participantIdentifier = this.dialogForm.controls['participantIdentifier'].value;
this.current.participantScheme = this.dialogForm.controls['participantScheme'].value;
this.current.documentIdentifier = this.dialogForm.controls['documentIdentifier'].value;
......@@ -122,16 +123,32 @@ export class ServiceMetadataWizardDialogComponent {
return this.current;
}
getParticipantElementXML(): string {
let schema = this.dialogForm.controls['participantScheme'].value;
let value= this.dialogForm.controls['participantIdentifier'].value;
if (!!schema && this.lookups.cachedApplicationConfig.concatEBCorePartyId &&
schema.startsWith(ServiceMetadataWizardDialogComponent.EBCORE_IDENTIFIER_PREFIX) ) {
value = schema + ":" + value;
schema =null;
}
return '<ParticipantIdentifier ' +
(!schema?'': 'scheme="' + this.xmlSpecialChars(schema) + '"')+ '>'
+ this.xmlSpecialChars(value)+ '</ParticipantIdentifier>';
}
getDocumentElementXML(): string {
return ' <DocumentIdentifier ' +
(!this.dialogForm.controls['documentIdentifierScheme'].value?'': 'scheme="'
+ this.xmlSpecialChars(this.dialogForm.controls['documentIdentifierScheme'].value) + '"') +
'>' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifier'].value) + '</DocumentIdentifier>';
}
getServiceMetadataXML() {
let exampleXML = '<ServiceMetadata xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05">' +
'\n <ServiceInformation>' +
'\n <ParticipantIdentifier scheme="' + this.xmlSpecialChars(this.dialogForm.controls['participantScheme'].value) + '">'
+ this.xmlSpecialChars(this.dialogForm.controls['participantIdentifier'].value)+ '</ParticipantIdentifier>' +
'\n <DocumentIdentifier ' +
(!this.dialogForm.controls['documentIdentifierScheme'].value?'': 'scheme="'
+ this.xmlSpecialChars(this.dialogForm.controls['documentIdentifierScheme'].value) + '"') +
'>' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifier'].value) + '</DocumentIdentifier>' +
'\n ' + this.getParticipantElementXML() +
'\n ' + this.getDocumentElementXML() +
'\n <ProcessList>' +
'\n <Process>' +
'\n <ProcessIdentifier ' +
......
......@@ -7,6 +7,7 @@ public class SmpConfigRO implements Serializable {
boolean smlIntegrationOn;
boolean smlParticipantMultiDomainOn;
boolean concatEBCorePartyId;
String participantSchemaRegExp;
String participantSchemaRegExpMessage;
......@@ -31,6 +32,14 @@ public class SmpConfigRO implements Serializable {
this.smlParticipantMultiDomainOn = smlParticipantMultidomainOn;
}
public boolean isConcatEBCorePartyId() {
return concatEBCorePartyId;
}
public void setConcatEBCorePartyId(boolean concatEBCorePartyId) {
this.concatEBCorePartyId = concatEBCorePartyId;
}
public String getParticipantSchemaRegExp() {
return participantSchemaRegExp;
}
......
......@@ -27,7 +27,7 @@ public enum SMPPropertyEnum {
PARTC_SCH_REGEXP_MSG("identifiersBehaviour.ParticipantIdentifierScheme.validationRegexMessage",
"Participant scheme must start with:urn:oasis:names:tc:ebcore:partyid-type:(iso6523:|unregistered:) OR must be up to 25 characters long with form [domain]-[identifierArea]-[identifierType] (ex.: 'busdox-actorid-upis') and may only contain the following characters: [a-z0-9].", "Error message for UI", false, false, false, STRING),
PARTC_EBCOREPARTYID_CONCATENATE("identifiersBehaviour.ParticipantIdentifierScheme.ebCoreId.concatenate",
"true", "Concatenate ebCore party id in XML responses <ParticipantIdentifier >urn:oasis:names:tc:ebcore:partyid-type:unregistered:test-ebcore-id</ParticipantIdentifier>", false, false, false, BOOLEAN),
"true", "Concatenate ebCore party id in XML responses <ParticipantIdentifier>urn:oasis:names:tc:ebcore:partyid-type:unregistered:test-ebcore-id</ParticipantIdentifier>", false, false, false, BOOLEAN),
CS_PARTICIPANTS("identifiersBehaviour.caseSensitive.ParticipantIdentifierSchemes", "sensitive-participant-sc1|sensitive-participant-sc2", "Specifies schemes of participant identifiers that must be considered CASE-SENSITIVE.", false, false, false, LIST_STRING),
CS_DOCUMENTS("identifiersBehaviour.caseSensitive.DocumentIdentifierSchemes", "casesensitive-doc-scheme1|casesensitive-doc-scheme2", "Specifies schemes of document identifiers that must be considered CASE-SENSITIVE.", false, false, false, LIST_STRING),
......
......@@ -47,7 +47,9 @@ public class ConfigurationService {
return (String)configurationDAO.getCachedPropertyValue(PARTC_SCH_REGEXP_MSG);
}
public Boolean getForceConcatenateEBCorePartyId() {
return (Boolean)configurationDAO.getCachedPropertyValue(PARTC_EBCOREPARTYID_CONCATENATE);
Boolean value = (Boolean) configurationDAO.getCachedPropertyValue(PARTC_EBCOREPARTYID_CONCATENATE);
// true by default
return value == null || value;
}
public Pattern getPasswordPolicyRexExp() {
......
......@@ -32,7 +32,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static eu.europa.ec.edelivery.smp.conversion.ServiceMetadataConverter.toSignedServiceMetadatadaDocument;
import static eu.europa.ec.edelivery.smp.conversion.ServiceMetadataConverter.toSignedServiceMetadataDocument;
import static eu.europa.ec.edelivery.smp.exceptions.ErrorCode.METADATA_NOT_EXISTS;
import static eu.europa.ec.edelivery.smp.exceptions.ErrorCode.SG_NOT_EXISTS;
......@@ -75,7 +75,7 @@ public class ServiceMetadataService {
}
DBServiceMetadata smd = osmd.get();
Document signedServiceMetadata = toSignedServiceMetadatadaDocument(smd.getXmlContent());
Document signedServiceMetadata = toSignedServiceMetadataDocument(smd.getXmlContent());
String sigCertAlias = smd.getServiceGroupDomain().getDomain().getSignatureKeyAlias();
signer.sign(signedServiceMetadata, sigCertAlias);
......
......@@ -40,6 +40,7 @@ public class ApplicationAdminResource {
info.setSmlParticipantMultiDomainOn(configurationService.isSMLMultiDomainEnabled());
info.setParticipantSchemaRegExp(configurationService.getParticipantIdentifierSchemeRexExpPattern());
info.setParticipantSchemaRegExpMessage(configurationService.getParticipantIdentifierSchemeRexExpMessage());
info.setConcatEBCorePartyId(configurationService.getForceConcatenateEBCorePartyId());
info.setPasswordValidationRegExp(configurationService.getPasswordPolicyRexExpPattern());
info.setPasswordValidationRegExpMessage(configurationService.getPasswordPolicyValidationMessage());
......
......@@ -126,6 +126,7 @@ public class ApplicationAdminResourceTest {
assertNotNull(res);
assertEquals("Participant scheme must start with:urn:oasis:names:tc:ebcore:partyid-type:(iso6523:|unregistered:) OR must be up to 25 characters long with form [domain]-[identifierArea]-[identifierType] (ex.: 'busdox-actorid-upis') and may only contain the following characters: [a-z0-9].", res.getParticipantSchemaRegExpMessage());
assertEquals("^((?!^.{26})([a-z0-9]+-[a-z0-9]+-[a-z0-9]+)|urn:oasis:names:tc:ebcore:partyid-type:(iso6523|unregistered)(:.+)?$)", res.getParticipantSchemaRegExp());
assertTrue(res.isConcatEBCorePartyId());
assertFalse(res.isSmlIntegrationOn());
assertFalse(res.isSmlParticipantMultiDomainOn());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment