diff options
Diffstat (limited to 'id/server/stork2-commons/src/main/java')
4 files changed, 44 insertions, 46 deletions
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 233cdebd0..1ddc02e15 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 @@ -53,7 +53,7 @@ public final class PersonalAttributeList extends ConcurrentHashMap<String, Perso /** * Hash with mapping number of alias or the attribute name. */ - private final Map<String, Integer> attrAliasNumber = new HashMap<String, Integer>(); + private final Map<String, List<String>> attrAliasNumber = new HashMap<String, List<String>>(); /** * Default constructor. @@ -123,28 +123,30 @@ public final class PersonalAttributeList extends ConcurrentHashMap<String, Perso * {@inheritDoc} */ public PersonalAttribute put(final String key, final PersonalAttribute val) { - if (StringUtils.isNotEmpty(key) && val != null) { - // Validate if attribute name already exists! - String attrAlias = key; - if (this.containsKey(attrAlias)) { - // TODO isAgeOver should not be hardcoded, a better way of handling multipe isAgeOver requests should be implemented. - if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0)) && "isAgeOver".equals(val.getName())) { - final String attrValue = val.getValue().get(0); - attrAlias = key + attrValue; - this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); + PersonalAttribute attr = val; + if (this.containsKey(key)) { + attr = this.get(key); + + if (!attr.isEmptyValue()) { + if (!attr.getValue().containsAll(val.getValue())) { + attr.getValue().addAll(val.getValue()); + } + } else { + + if (!attr.isEmptyComplexValue()) { + for (Map<String, String> valTemp : val.getComplexValues()) { + if (!attr.getComplexValues().contains(valTemp)) { + attr.setComplexValue(valTemp); + } + } } else { - final PersonalAttribute attr = super.get(key); - if (!attr.isEmptyValue() && StringUtils.isNumeric(attr.getValue().get(0))) { - attrAlias = key + attr.getValue().get(0); - super.put(key, (PersonalAttribute) attr); - this.attrAliasNumber.put(key, null); + if (STORKStatusCode.STATUS_NOT_AVAILABLE.toString().equals(attr.getStatus())) { + attr = val; } } } - return super.put(attrAlias, val); - } else { - return null; } + return super.put(key, attr); } /** diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java index 566817747..33ae4c743 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryRequest.java @@ -2,18 +2,11 @@ package eu.stork.peps.auth.commons; import java.io.Serializable;
-import org.apache.log4j.Logger;
-
public class STORKAttrQueryRequest implements Serializable, Cloneable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 4778480781609392750L;
- /**
- * Logger object.
- */
- private static final Logger LOG = Logger.getLogger(STORKAttrQueryRequest.class.getName());
-
/** The samlId. */
private String samlId;
@@ -290,13 +283,7 @@ public class STORKAttrQueryRequest implements Serializable, Cloneable { * @see IPersonalAttributeList
*/
public IPersonalAttributeList getPersonalAttributeList() {
- IPersonalAttributeList personnalAttributeList = null;
- try {
- personnalAttributeList = (IPersonalAttributeList) attributeList.clone();
- } catch (CloneNotSupportedException e1) {
- LOG.trace("[PersonalAttribute] Nothing to do.");
- }
- return personnalAttributeList;
+ return (IPersonalAttributeList) attributeList.clone();
}
/**
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java index cd54fb8b7..ac4663eaf 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java @@ -164,13 +164,7 @@ public class STORKAttrQueryResponse implements Serializable { * @see PersonalAttributeList
*/
public IPersonalAttributeList getPersonalAttributeList() {
- IPersonalAttributeList personnalAttributeList = null;
- try {
- personnalAttributeList = (IPersonalAttributeList) attributeList.clone();
- } catch (CloneNotSupportedException e1) {
- LOG.trace("[PersonalAttribute] Nothing to do.");
- }
- return personnalAttributeList;
+ return (IPersonalAttributeList) attributeList.clone();
}
/**
@@ -354,13 +348,7 @@ public class STORKAttrQueryResponse implements Serializable { * @see PersonalAttributeList
*/
public IPersonalAttributeList getTotalPersonalAttributeList() {
- IPersonalAttributeList personnalAttributeList = null;
- try {
- personnalAttributeList = (IPersonalAttributeList) totalAttributeList.clone();
- } catch (CloneNotSupportedException e1) {
- LOG.trace("[PersonalAttribute] Nothing to do.");
- }
- return personnalAttributeList;
+ return (IPersonalAttributeList) totalAttributeList.clone();
}
/**
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java index fe90056bf..8606b6389 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKLogoutResponse.java @@ -38,6 +38,9 @@ public class STORKLogoutResponse implements Serializable, Cloneable { /** Logout failed? */
private boolean fail;
+ /** The inResponseTo */
+ private String inResponseTo;
+
/**
* Gets the SP's Certificate Alias.
*
@@ -257,4 +260,22 @@ public class STORKLogoutResponse implements Serializable, Cloneable { return storkLogoutResponse;
}
+
+ /**
+ * Getter for the inResponseTo value.
+ *
+ * @return The inResponseTo value.
+ */
+ public String getInResponseTo() {
+ return inResponseTo;
+ }
+
+ /**
+ * Setter for the inResponseTo value.
+ *
+ * @param inResponseTo the new inResponseTo value.
+ */
+ public void setInResponseTo(String inResponseTo) {
+ this.inResponseTo = inResponseTo;
+ }
}
|