diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-03-07 10:56:53 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-03-07 10:56:53 +0100 |
commit | fc15ed904e615e7768c4081940482c5377a6d6a3 (patch) | |
tree | 26dd7e36db7db5fde5f529c6c71109453c8ac075 | |
parent | dc242cc927974270476c9c836ea7fe07c0a2a43e (diff) | |
download | moa-id-spss-fc15ed904e615e7768c4081940482c5377a6d6a3.tar.gz moa-id-spss-fc15ed904e615e7768c4081940482c5377a6d6a3.tar.bz2 moa-id-spss-fc15ed904e615e7768c4081940482c5377a6d6a3.zip |
use first NameIDFormat from metadata
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java index 1454ee297..7f5e2420e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java @@ -53,6 +53,8 @@ import org.opensaml.saml2.metadata.RequestedAttribute; import org.opensaml.saml2.metadata.SPSSODescriptor; import org.w3c.dom.Element; +import edu.emory.mathcs.backport.java.util.Arrays; + import at.gv.e_government.reference.namespace.mandates._20040701_.Mandate; import at.gv.e_government.reference.namespace.persondata._20020228_.CorporateBodyType; import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType; @@ -313,9 +315,17 @@ public class PVP2AssertionBuilder implements PVPConstants { List<NameIDFormat> metadataNameIDFormats = spSSODescriptor.getNameIDFormats(); if (metadataNameIDFormats != null) { - if (metadataNameIDFormats.size() == 1) - nameIDFormat = metadataNameIDFormats.get(0).getFormat(); + for (NameIDFormat el : metadataNameIDFormats) { + if (NameID.PERSISTENT.equals(el.getFormat())) { + nameIDFormat = NameID.PERSISTENT; + break; + + } else if (NameID.TRANSIENT.equals(el.getFormat()) || + NameID.UNSPECIFIED.equals(el.getFormat())) + break; + + } } } |