From 496ba9bb6e150ad67c5c628c1c97f30d6da81dfb Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 10 Aug 2015 16:35:14 +0200 Subject: approved changes --- .../eu/stork/peps/auth/commons/AttributeName.java | 11 ++- .../peps/auth/commons/AttributeProvidersMap.java | 18 +++++ .../stork/peps/auth/commons/AttributeSource.java | 14 ++-- .../eu/stork/peps/auth/commons/AttributeUtil.java | 4 +- .../peps/auth/commons/IAttributeListProcessor.java | 49 +++++++++++- .../peps/auth/commons/IAttributeProvidersMap.java | 7 ++ .../peps/auth/commons/IPersonalAttributeList.java | 23 +++++- .../java/eu/stork/peps/auth/commons/Linker.java | 31 ++++++-- .../eu/stork/peps/auth/commons/PEPSErrors.java | 12 ++- .../eu/stork/peps/auth/commons/PEPSParameters.java | 25 +++++- .../eu/stork/peps/auth/commons/PEPSValues.java | 6 +- .../stork/peps/auth/commons/PersonalAttribute.java | 57 ++++++++++++-- .../peps/auth/commons/PersonalAttributeList.java | 88 ++++++++++++++++++++-- .../stork/peps/auth/commons/STORKAuthnRequest.java | 8 +- .../peps/auth/commons/STORKAuthnResponse.java | 35 +++++---- .../tc/stork/_1_0/assertion/ObjectFactory.java | 16 ++-- 16 files changed, 337 insertions(+), 67 deletions(-) (limited to 'id/server/stork2-commons/src/main/java') diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java index f47cca6be..28115ae62 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeName.java @@ -1,13 +1,20 @@ package eu.stork.peps.auth.commons; +import java.io.Serializable; + /** * This class is a bean used to store information relative to Attribute Names. - * + * * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr) * * @version $Revision: 1.00 $, $Date: 2013-11-26 $ */ -public final class AttributeName { +public final class AttributeName implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3537736618869722308L; /** * Attribute Id. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java index 24d93f9bb..c59109092 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java @@ -91,4 +91,22 @@ public class AttributeProvidersMap extends LinkedHashMap maKeys = aPMap.keyIterator(); + while (maKeys.hasNext()) { + AttributeSource key = maKeys.next(); + IPersonalAttributeList l2 = aPMap.get(key); + if (containsKey(key)) { + IPersonalAttributeList l1 = get(key); + for (PersonalAttribute pa : l2) { + if (!l1.containsKey(pa.getName())) { + l1.add(pa); + } + } + } else { + put(key, l2); + } + } + } } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java index 8064131a7..eb5e3ded4 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeSource.java @@ -148,10 +148,11 @@ public final class AttributeSource implements Serializable { LOG.debug("Calling equals with Object."); if (obj instanceof AttributeSource) { LOG.debug("Calling equals with AttributeSource."); - outcome = this.equals((AttributeSource) obj); + outcome = this.innerEquals((AttributeSource) obj); + } + if (LOG.isDebugEnabled()) { + LOG.debug("Object equals outcome: " + outcome); } - - LOG.debug("Object equals outcome: " + outcome); return outcome; } @@ -163,7 +164,7 @@ public final class AttributeSource implements Serializable { * * @return true if the two objects are equal */ - public boolean equals(AttributeSource obj) { + public boolean innerEquals(AttributeSource obj) { boolean outcome = false; if (this.sourceType == obj.getSourceType()) { @@ -175,8 +176,9 @@ public final class AttributeSource implements Serializable { outcome = true; } } - - LOG.debug("AttributeSource equals outcome: " + outcome); + if (LOG.isDebugEnabled()) { + LOG.debug("AttributeSource equals outcome: " + outcome); + } return outcome; } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java index 18218dce4..f49986aaf 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeUtil.java @@ -108,7 +108,7 @@ public final class AttributeUtil { strBuilder.append(AttributeUtil.escape(s) + separator); } } - return strBuilder.toString(); + return strBuilder.substring(0, strBuilder.length() - 1).toString(); } /** @@ -132,7 +132,7 @@ public final class AttributeUtil { strBuilder.append(AttributeUtil.escape(entry.getValue())); strBuilder.append(separator); } - return strBuilder.toString(); + return strBuilder.substring(0, strBuilder.length() - 1).toString(); } /** diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java index ffae4ae67..bdcf58fec 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeListProcessor.java @@ -108,6 +108,18 @@ public interface IAttributeListProcessor { */ IPersonalAttributeList removeAPMandatoryAttributes(IPersonalAttributeList attrList, Map attributes); + /** + * Removes from attribute list the Stork list of attributes. + * + * @param attrList + * the requested attribute list + * + * @return the attribute list without rejected attributes. + * + * @see IPersonalAttributeList + */ + IPersonalAttributeList removeAPRejectedAttributes(IPersonalAttributeList attrList); + /** * Checks if mandate attribute exist in the requested Attribute List. Power attribute name to lookup is loaded by implementation. * @@ -153,4 +165,39 @@ public interface IAttributeListProcessor { */ Map getNormalAttributesAdded(); -} \ No newline at end of file + /** + * Adds normal attributes to personal attribute list if exist in original list (allAttrList). + * + * @param attrList + * the list which will be updated + * @param allAttrList + * the list to check if attributes are to be included. + * + * + * @return the attributes list updated. + */ + IPersonalAttributeList addNormalAttributes(IPersonalAttributeList attrList, IPersonalAttributeList allAttrList); + + /** + * Updates list by filtering any attribute that must be requested instead of using a value obtained from cache (business and legal attrs) + * + * @param attrList + * the list which will be updated + * @return the filtered list + */ + IPersonalAttributeList filterAttrList(IPersonalAttributeList attrList); + + /** + * Updates the list of cached attrs by inserting the business and/or legal attrs requested by the user + * + * @param cachedAttrList + * @param requestedAttrsList + */ + void updateAttrList(IPersonalAttributeList cachedAttrList, IPersonalAttributeList requestedAttrsList); + + /** + * Verifies if normal attribute list contains any attribute that we must always request (usually business attributes) + */ + boolean hasAlwaysRequestAttributes(IPersonalAttributeList attributeList); + +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java index aa0ddf85b..cc5fe977f 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IAttributeProvidersMap.java @@ -78,4 +78,11 @@ public interface IAttributeProvidersMap { * @return an iterator of the keys contained in this map */ Iterator keyIterator(); + + /** + * Merges this Attribute Providers Map with another providers map changes the contents of this map so it returns null + * + * @param aPMap + */ + void mergeWith(IAttributeProvidersMap aPMap); } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java index 71b3400b4..7eb788461 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/IPersonalAttributeList.java @@ -42,6 +42,20 @@ public interface IPersonalAttributeList extends Iterable, Clo */ PersonalAttribute put(String key, PersonalAttribute value); + /** + * Replaces the specified value with the specified key in this Personal Attribute List. + * + * @param key + * with which the specified value is to be replaced. + * @param value + * to be associated with the specified key. + * + * @return the previous value associated with key, or null if there was no mapping for key. + * + * @see PersonalAttribute + */ + PersonalAttribute replace(String key, PersonalAttribute value); + /** * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. * @@ -146,6 +160,13 @@ public interface IPersonalAttributeList extends Iterable, Clo */ IPersonalAttributeList getMandatoryAttributes(); + /** + * Returns a IPersonalAttributeList merged with provided one. + * + * @return an IPersonalAttributeList the attribute list to merge with. + */ + IPersonalAttributeList merge(IPersonalAttributeList attrList); + /** * Returns a IPersonalAttributeList of the optional attributes in this map. * @@ -172,6 +193,6 @@ public interface IPersonalAttributeList extends Iterable, Clo * * @return The copy of this IPersonalAttributeList. */ - Object clone() throws CloneNotSupportedException; + Object clone(); } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java index f82f6fbcc..87ab4275f 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/Linker.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import org.apache.log4j.Logger; @@ -36,7 +37,7 @@ public final class Linker implements Serializable { /** * Assertion map. */ - private LinkedHashMap assertions; + private Map> assertions; /** * The current index of local (domestic) Attribute Providers. @@ -55,7 +56,7 @@ public final class Linker implements Serializable { localIndex = 0; remoteIndex = 0; - assertions = new LinkedHashMap(); + assertions = new LinkedHashMap>(); } /** @@ -143,13 +144,19 @@ public final class Linker implements Serializable { localIndex++; // Assertion storage - this.assertions.put(source, attrResponse); - // previously: getTotalPersonalAttributeList() in both cases - if (source.getSourceType() == AttributeSource.SOURCE_REMOTE_COUNTRY) + if (this.assertions.containsKey(source)) { + this.assertions.get(source).add(attrResponse); + } else { + List temp = new ArrayList(); + temp.add(attrResponse); + this.assertions.put(source, temp); + } + + if (source.getSourceType() == AttributeSource.SOURCE_REMOTE_COUNTRY) { this.attributeProvidersMap.put(source, attrResponse.getTotalPersonalAttributeList()); - else + } else { this.attributeProvidersMap.put(source, attrResponse.getPersonalAttributeList()); - // this.attributeProvidersMap.put(source, attrResponse.getTotalPersonalAttributeList()); + } } /** @@ -312,5 +319,13 @@ public final class Linker implements Serializable { LOG.debug("The attributeProvidersMap after the merge."); ((AttributeProvidersMap) this.attributeProvidersMap).trace(); } + + for (AttributeSource as : previous.assertions.keySet()) { + if (!assertions.containsKey(as)) { + assertions.put(as, previous.assertions.get(as)); + } else { + assertions.get(as).addAll(previous.assertions.get(as)); + } + } } -} \ No newline at end of file +} diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java index ac83d5ddf..7d758d754 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSErrors.java @@ -314,7 +314,17 @@ public enum PEPSErrors { /** * Represents the 'invalid.attr.country.code' constant error identifier. */ - INVALID_COUNTRY_CODE("invalid.attr.country.code"); + INVALID_COUNTRY_CODE("invalid.attr.country.code"), + /** + * DTL error codes. + */ + DTL_ERROR_ADD("dtl.error.adding.doc"), DTL_ERROR_GET("dtl.error.getting.doc"), DTL_ERROR_REQUEST("dtl.error.request.attribute"), DTL_INVALID_XML("dtl.invalid.xml"), DTL_EMPTY_REQUEST( + "dtl.empty.request"), DTL_ERROR_DOCUMENT_URL("dtl.error.no.document.url"), DTL_ERROR_NO_DOCUMENT("dtl.error.no.document"), DTL_ERROR_MARSHALL_SIGNREQUEST("dtl.error.marshall.signrequest"), DTL_ERROR_MARSHALL_SIGNRESPONSE( + "dtl.error.marshall.signresponse"), + /** + * Represents the 'colleagueAttributeRequest.invalidSAML' constant error identifier. + */ + COLLEAGUE_LOGOUT_INVALID_SAML("colleagueLogoutRequest.invalidSAML"); /** * Represents the constant's value. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java index ec967a2ee..6b876b680 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSParameters.java @@ -68,6 +68,10 @@ public enum PEPSParameters { * Represents the 'attrList' parameter constant. */ ATTRIBUTE_LIST("attrList"), + /** + * Represents the 'allAttrList' parameter constant. + */ + ALL_ATTRIBUTE_LIST("allAttrList"), /** * Represents the 'apMandAttrList' parameter constant. */ @@ -106,7 +110,7 @@ public enum PEPSParameters { /** * Represents the complex attributes parameter constant. */ - COMPLEX_ADDRESS_VALUE("canonicalResidenceAddress"), COMPLEX_NEWATTRIBUTE_VALUE("newAttribute2"), COMPLEX_HASDEGREE_VALUE("hasDegree"), COMPLEX_MANDATECONTENT_VALUE("mandateContent"), + COMPLEX_ADDRESS_VALUE("canonicalResidenceAddress"), COMPLEX_NEWATTRIBUTE_VALUE("newAttribute2"), COMPLEX_HASDEGREE_VALUE("hasDegree"), COMPLEX_MANDATECONTENT_VALUE("mandate"), /** * Represents the 'consent-type' parameter constant. */ @@ -603,8 +607,23 @@ public enum PEPSParameters { /** * Represents the 'idPDerivedAttrList' parameter constant. */ - - IDP_DERIVED_ATTR_LIST("idPDerivedAttrList"); + IDP_DERIVED_ATTR_LIST("idPDerivedAttrList"), + /** + * Represents the 'apRejectedAttrsList' parameter constant. + */ + AP_REJECTED_ATTRS_LIST("apRejectedAttrsList"), + /** + * Represents the 'logoutRequest' parameter constant. + */ + LOGOUT_REQUEST("logoutRequest"), + /** + * Represents the 'logoutRequest' parameter constant. + */ + LOGOUT_RESPONSE("logoutResponse"), + /** + * Represents the 'logoutRequest' parameter constant. + */ + LOGOUT_DEST_URL("speps.logout.destination.url"); /** * Represents the constant's value. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java index 9cc587d7f..a63db12e1 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PEPSValues.java @@ -246,7 +246,11 @@ public enum PEPSValues { /** * Represents the 'attr-filter' constant value. */ - AP_ATTRFILTER_PREFIX("attr-filter"); + AP_ATTRFILTER_PREFIX("attr-filter"), + /** + * Represents the 'save-session' constant value. + */ + SAVED_SESSION("saved-session"); /** * Represents the constant's value. diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java index 49ea3e695..8d1482f05 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttribute.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; +import java.util.Vector; import org.apache.log4j.Logger; @@ -60,7 +60,7 @@ public final class PersonalAttribute implements Serializable, Cloneable { /** * Complex values of the personal attribute. */ - private Map complexValue = new ConcurrentHashMap(); + private List> complexValue = new Vector>(); /** * Is the personal attribute mandatory? @@ -138,8 +138,7 @@ public final class PersonalAttribute implements Serializable, Cloneable { personalAttr.setValue(val); } if (!isEmptyComplexValue()) { - final Map complexVal = (Map) ((HashMap) this.getComplexValue()).clone(); - personalAttr.setComplexValue(complexVal); + personalAttr.addComplexValues(this.getComplexValues()); } return personalAttr; } catch (final CloneNotSupportedException e) { @@ -208,6 +207,18 @@ public final class PersonalAttribute implements Serializable, Cloneable { } } + /** + * Add new value to list of values. + * + * @param attrValue + * The personal attribute value. + */ + public void addValue(final String attrValue) { + if (attrValue != null) { + this.value.add(attrValue); + } + } + /** * Getter for the type value. * @@ -252,6 +263,19 @@ public final class PersonalAttribute implements Serializable, Cloneable { * @return The complex value. */ public Map getComplexValue() { + if (complexValue.size() > 0) { + return complexValue.get(0); + } else { + return new HashMap(); + } + } + + /** + * Getter for the complex values. + * + * @return The complex value. + */ + public List> getComplexValues() { return complexValue; } @@ -263,10 +287,20 @@ public final class PersonalAttribute implements Serializable, Cloneable { */ public void setComplexValue(final Map complexVal) { if (complexVal != null) { - this.complexValue = complexVal; + this.complexValue.add(complexVal); } } + /** + * Setter for the complex values. + * + * @param complexVal + * The personal attribute Complex values. + */ + public void addComplexValues(final List> complexVals) { + this.complexValue.addAll(complexVals); + } + /** * Getter for the personal's friendly name. * @@ -301,7 +335,7 @@ public final class PersonalAttribute implements Serializable, Cloneable { * @return True if the Complex Value is empty; */ public boolean isEmptyComplexValue() { - return complexValue.isEmpty(); + return complexValue.isEmpty() || complexValue.get(0).isEmpty(); } /** @@ -343,4 +377,15 @@ public final class PersonalAttribute implements Serializable, Cloneable { return strBuild.toString(); } + /** + * Empties the Value or ComplexValue field of a PersonalAttribute + */ + public void setEmptyValue() { + if (this.isEmptyValue()) { + this.complexValue = new Vector>(); + } else { + this.value = new ArrayList(); + } + } + } diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java index 8f60bdc0d..233cdebd0 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java @@ -13,7 +13,6 @@ */ package eu.stork.peps.auth.commons; -import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -34,7 +33,7 @@ import org.apache.log4j.Logger; * @see PersonalAttribute */ @SuppressWarnings("PMD") -public final class PersonalAttributeList extends ConcurrentHashMap implements IPersonalAttributeList, Serializable { +public final class PersonalAttributeList extends ConcurrentHashMap implements IPersonalAttributeList { /** * Logger object. @@ -88,10 +87,17 @@ public final class PersonalAttributeList extends ConcurrentHashMap this.attrAliasNumber.get(key).size()) { + index = 0; + } + + attrName = this.attrAliasNumber.get(key).get(index); + this.latestAttrAlias.put((String) key, Integer.valueOf(++index)); } else { if (this.attrAliasNumber.containsKey(key)) { - this.latestAttrAlias.put(attrName, this.attrAliasNumber.get(key)); + this.latestAttrAlias.put((String) key, Integer.valueOf(0)); + attrName = this.attrAliasNumber.get(key).get(0); } } return super.get(attrName); @@ -106,6 +112,13 @@ public final class PersonalAttributeList extends ConcurrentHashMap 4) { + LOG.info("Found attributes with special characters, escaping special characters"); + + if (s.split(reqRegex) == null) { + boolAttr = PEPSValues.FALSE.toString(); + } + + tempBuilder.setLength(0); + tempBuilder.append(AttributeUtil.escape(s.split(reqRegexSeparator)[0])); + tempBuilder.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + tempBuilder.append(boolAttr); + tempBuilder.append(PEPSValues.ATTRIBUTE_TUPLE_SEP.toString()); + tempBuilder.append(s.split(reqRegexSeparator)[1]); + + } + + finalAttr.append(tempBuilder.toString()); + finalAttr.append(PEPSValues.ATTRIBUTE_SEP.toString()); + } + return finalAttr.toString(); + } + + /** + * Unescape a string + * + * @see PersonalAttributeList#attrListEncoder + * */ + private String attrListDecoder(String string) { + return AttributeUtil.unescape(string); + } + public void populate(final String attrList) { - final StringTokenizer strToken = new StringTokenizer(attrList, PEPSValues.ATTRIBUTE_SEP.toString()); + + final StringTokenizer strToken = new StringTokenizer(attrListEncoder(attrList), PEPSValues.ATTRIBUTE_SEP.toString()); while (strToken.hasMoreTokens()) { final PersonalAttribute persAttr = new PersonalAttribute(); @@ -163,6 +222,9 @@ public final class PersonalAttributeList extends ConcurrentHashMap getNormalizedPersonalAttributeList() { + List returnAttrList = new ArrayList(); + + if (this.totalAttributeList.isEmpty()) { + this.totalAttributeList = this.attributeList; + } + + for (PersonalAttribute pa : this.totalAttributeList) { + // Get the shortname of the attribute by removing + // the attached assertionId, if there is one and + // put the shortname as the attribute name + pa.setName(pa.getName().split("_")[0]); + // We add it to the return list. + returnAttrList.add(pa); } - return personnalAttributeList; + return returnAttrList; } /** diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/eu/stork/names/tc/stork/_1_0/assertion/ObjectFactory.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/eu/stork/names/tc/stork/_1_0/assertion/ObjectFactory.java index 6eaa63c5a..82ec6d3b4 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/eu/stork/names/tc/stork/_1_0/assertion/ObjectFactory.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/eu/stork/names/tc/stork/_1_0/assertion/ObjectFactory.java @@ -71,19 +71,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link MandateType } - * + * Create an instance of {@link RequestedAttributeType } + * */ - public MandateType createMandateType() { - return new MandateType(); + public RequestedAttributeType createRequestedAttributeType() { + return new RequestedAttributeType(); } /** - * Create an instance of {@link RequestedAttributeType } - * + * Create an instance of {@link MandateType } + * */ - public RequestedAttributeType createRequestedAttributeType() { - return new RequestedAttributeType(); + public MandateType createMandateType() { + return new MandateType(); } /** -- cgit v1.2.3