diff options
author | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-08-10 16:35:14 +0200 |
---|---|---|
committer | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-08-10 16:45:26 +0200 |
commit | 496ba9bb6e150ad67c5c628c1c97f30d6da81dfb (patch) | |
tree | 1dbe494358ab717b2bf94bae9fd3c3f90f4dbd58 /id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java | |
parent | f71531346c6be197957311712ba093e024545e37 (diff) | |
download | moa-id-spss-496ba9bb6e150ad67c5c628c1c97f30d6da81dfb.tar.gz moa-id-spss-496ba9bb6e150ad67c5c628c1c97f30d6da81dfb.tar.bz2 moa-id-spss-496ba9bb6e150ad67c5c628c1c97f30d6da81dfb.zip |
approved changes
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.java | 35 |
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; } /** |