aboutsummaryrefslogtreecommitdiff
path: root/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java')
-rw-r--r--id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java
index 4b415bbcf..32bfd0df0 100644
--- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java
+++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java
@@ -14,6 +14,7 @@
package eu.stork.peps.auth.commons;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
@@ -26,7 +27,7 @@ import org.opensaml.saml2.core.Assertion;
* @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com, hugo.magalhaes@multicert.com, paulo.ribeiro@multicert.com
* @version $Revision: 1.15 $, $Date: 2010-11-17 05:15:28 $
*/
-public final class STORKAuthnResponse implements Serializable {
+public final class STORKAuthnResponse implements Serializable, Cloneable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -9100982727074068660L;
@@ -167,13 +168,7 @@ public final class STORKAuthnResponse 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();
}
/**
@@ -347,13 +342,25 @@ public final class STORKAuthnResponse 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 (IPersonalAttributeList) totalAttributeList.clone();
+ }
+
+ public List<PersonalAttribute> getNormalizedPersonalAttributeList() {
+ List<PersonalAttribute> returnAttrList = new ArrayList<PersonalAttribute>();
+
+ 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;
}
/**