diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-13 11:33:41 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-13 11:33:41 +0200 |
commit | 72b7bf07c9c070bc8aa4020568c849cb749c0dd8 (patch) | |
tree | 7cbbf0b01f9448b1edc5cd2d50a78c2e68782aef /id/server/idserverlib/src | |
parent | e7842b994f4dd5d4e8ad88a4db8ddf23707714cf (diff) | |
parent | d242908f5f71864403ac930e1a168f96333157ad (diff) | |
download | moa-id-spss-72b7bf07c9c070bc8aa4020568c849cb749c0dd8.tar.gz moa-id-spss-72b7bf07c9c070bc8aa4020568c849cb749c0dd8.tar.bz2 moa-id-spss-72b7bf07c9c070bc8aa4020568c849cb749c0dd8.zip |
Merge branch 'moa-2.1-Snapshot' of gitlab.iaik.tugraz.at:afitzek/moa-idspss into moa-2.1-Snapshot
Diffstat (limited to 'id/server/idserverlib/src')
3 files changed, 39 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java index 4ea32c602..8d56360b6 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java @@ -247,6 +247,7 @@ public class AttributeCollector implements IAction { Logger.debug("...successful"); Logger.info(e.getAp().getClass().getSimpleName() + " is going to ask an external service provider for the requested attributes"); + // add container-key to redirect embedded within the return URL e.getAp().performRedirect(AuthConfigurationProvider.getInstance().getPublicURLPrefix() + "/stork2/ResumeAuthentication?" + ARTIFACT_ID + "=" + newArtifactId, request, response, oaParam); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java index 95b59314d..1d081fb1c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java @@ -31,6 +31,7 @@ import java.io.StringWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; +import java.util.regex.Pattern; /** * @@ -131,6 +132,18 @@ public class MandateRetrievalRequest implements IAction { String eLPIdentifier = geteLPIdentifier(mandateContainer, currentAttribute); PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), "Available"); attributeList.add(personalAttribute); + } else if (currentAttribute.getName().equals("type")) { + String type = getCompanyType(mandateContainer, currentAttribute); + PersonalAttribute personalAttribute; + if (type.length() > 0) { + attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), "Available")); + } else { + attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), "NotAvailable")); + } + } else if (currentAttribute.getName().equals("translatableType")) { + String translatableType = ""; + PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(translatableType), "Available"); + attributeList.add(personalAttribute); } } @@ -241,6 +254,25 @@ public class MandateRetrievalRequest implements IAction { } + private String getCompanyType(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) throws MOAIDException { + String legalName = getLegalName(mandateContainer, sourceAttribute); + + ArrayList<Pattern> gmbhPatterns = new ArrayList<Pattern>(); + gmbhPatterns.add(Pattern.compile(".+ gmbh$", Pattern.CASE_INSENSITIVE)); + gmbhPatterns.add(Pattern.compile(".+ Handelsges\\.m\\.b\\.H\\.$", Pattern.CASE_INSENSITIVE)); + gmbhPatterns.add(Pattern.compile(".+ Gesellschaft m\\.b\\.H\\.$", Pattern.CASE_INSENSITIVE)); + gmbhPatterns.add(Pattern.compile(".+ gesmbh$", Pattern.CASE_INSENSITIVE)); + + for (Pattern pattern : gmbhPatterns) { + if (pattern.matcher(legalName).matches()) { + return "GmbH"; + } + } + + return ""; + } + + private RepresentationPersonType getRepresentative(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) { RepresentationPersonType representative = new RepresentationPersonType(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java index d08720f83..ba01de0fb 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java @@ -86,6 +86,12 @@ public class MandateAttributeRequestProvider extends AttributeProvider { requestedAttributes.add(personalAttribute); } + // continue with other attribute providers if there are no attributes current provider is able to handle + if (requestedAttributes.size() == 0) { + Logger.info("Attribute(s) " + attributes.toString() + " not supported by the provider: " + getAttrProviderName()); + throw new UnsupportedAttributeException(); + } + Logger.info("Thrown external request by: " + getAttrProviderName()); throw new ExternalAttributeRequestRequiredException(this); } |