summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas <>2021-03-11 12:11:28 +0100
committerThomas <>2021-03-11 12:11:28 +0100
commit920a3f289687fbbfba6ab58a66d1cba3099e4f75 (patch)
tree848be74635c3974e9f5512020ea10d5b5727fd8f /src
parent5aa1fb9d1ec0d01bd553e6743363ce2eaa9751a3 (diff)
downloadegovutils-920a3f289687fbbfba6ab58a66d1cba3099e4f75.tar.gz
egovutils-920a3f289687fbbfba6ab58a66d1cba3099e4f75.tar.bz2
egovutils-920a3f289687fbbfba6ab58a66d1cba3099e4f75.zip
fix bug in ElectonicIdentity DAO that does not distinguish between baseId and bPK in SAML1 response
switch to next snapshot version
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/gv/util/data/ElectronicIdentity.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main/java/at/gv/util/data/ElectronicIdentity.java b/src/main/java/at/gv/util/data/ElectronicIdentity.java
index afbf652..c85c8b9 100644
--- a/src/main/java/at/gv/util/data/ElectronicIdentity.java
+++ b/src/main/java/at/gv/util/data/ElectronicIdentity.java
@@ -95,6 +95,7 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
private static final String BPK_NAME_QUALIFIER = "urn:publicid:gv.at:cdid+bpk";
private static final String WBPK_NAME_QUALIFIER_PREFIX = "urn:publicid:gv.at:wbpk";
private static final String BASE_NAME_QUALIFIER = "urn:publicid:gv.at:baseid";
+ private static final String BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET = "urn:publicid:gv.at:cdid+";
private String firstName;
private String title;
@@ -289,6 +290,15 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
this.bpk = this.getNameIdentifier();
}
+ if (this.getNameQualifier() != null
+ && this.getNameQualifier().startsWith(BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET)
+ && MiscUtil.isEmpty(this.getBpk())
+ && MiscUtil.isNotEmpty(this.getNameIdentifier())) {
+ log.debug("NameQualifier starts with \"" + BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET
+ + "\". We have a bpk for target: " + this.getNameQualifier());
+ this.bpk = this.getNameIdentifier();
+ }
+
if (MiscUtil.isNotEmpty(this.getBaseId())) {
log.debug("BaseId present -> calculating zbpk");
this.zbpk = BpkUtil.calcZBPK(this.getBaseId());
@@ -450,9 +460,20 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
.createUnmarshaller().unmarshal(personNode);
PhysicalPersonType ppt = pptElement.getValue();
String baseId = ppt.getIdentification().get(0).getValue().getValue();
- this.setBaseId(baseId);
- this.setZbpk(BpkUtil.calcZBPK(baseId));
- this.setVzbpk(BpkUtil.calcVZBPK(baseId));
+ String baseIdType = ppt.getIdentification().get(0).getType();
+ if (BASE_NAME_QUALIFIER.equals(baseIdType)) {
+ this.setBaseId(baseId);
+ this.setZbpk(BpkUtil.calcZBPK(baseId));
+ this.setVzbpk(BpkUtil.calcVZBPK(baseId));
+
+ } else {
+ log.info("Get no baseId. Set it as it is ... ");
+ this.nameIdentifier = baseId;
+ this.nameQualifier = baseIdType;
+ updateAll();
+
+ }
+
this.setDateOfBirth(MiscUtil.parseXMLDate(ppt.getDateOfBirth(), TimeZone.getTimeZone("UTC")));
this.setFirstName(ppt.getName().getGivenName().get(0));
this.setLastName(ppt.getName().getFamilyName().get(0).getValue());