aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java57
1 files changed, 55 insertions, 2 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
index ef5a367..79a674e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
@@ -48,8 +48,10 @@ import iaik.utils.RFC2253NameParserException;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOASystemException;
import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult;
+import at.gv.egovernment.moa.spss.api.common.TslInfos;
import at.gv.egovernment.moaspss.util.Base64Utils;
import at.gv.egovernment.moaspss.util.Constants;
+import at.gv.egovernment.moaspss.util.MiscUtil;
/**
* Utility methods used by the verious <code>ResponseBuilder</code> classes.
@@ -127,7 +129,8 @@ public class ResponseBuilderUtils {
String publicAuthorityID,
boolean isSSCD,
String sscdSource,
- String issuerCountryCode)
+ String issuerCountryCode,
+ TslInfos tslInfos)
throws MOAApplicationException {
Element signerInfoElem = response.createElementNS(MOA_NS_URI, "SignerInfo");
@@ -158,7 +161,53 @@ public class ResponseBuilderUtils {
issuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "IssuerCountryCode");
issuerCountryCodeElem.setTextContent(issuerCountryCode);
}
-
+
+ //add TSL infos
+ Element tslInfoElement = null;
+ if (tslInfos != null) {
+ tslInfoElement = response.createElementNS(MOA_NS_URI, "TSLInformation");
+
+ //append TSL issuer country-code
+ if (MiscUtil.isNotEmpty(tslInfos.getTslIssuerCountry())); {
+ Element tslIssuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "TSLIssuerCountryCode");
+ tslIssuerCountryCodeElem.setTextContent(tslInfos.getTslIssuerCountry());
+ tslInfoElement.appendChild(tslIssuerCountryCodeElem);
+
+ }
+
+ //append Service-Type Status
+ if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeStatus())); {
+ Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeStatus");
+ tslServiceInfo.setTextContent(tslInfos.getServiceTypeStatus());
+ tslInfoElement.appendChild(tslServiceInfo);
+
+ }
+
+ //append Service-Type Identifier
+ if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeIdentifier())); {
+ Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeIdentifier");
+ tslServiceInfo.setTextContent(tslInfos.getServiceTypeIdentifier());
+ tslInfoElement.appendChild(tslServiceInfo);
+
+ }
+
+ //append qualifiers
+ if (tslInfos.getQualifiers() != null && tslInfos.getQualifiers().size() > 0) {
+ Element tslQualifiers = response.createElementNS(MOA_NS_URI, "Qualifiers");
+
+ for (String el : tslInfos.getQualifiers()) {
+ Element tslQualifier = response.createElementNS(MOA_NS_URI, "Qualifier");
+ tslQualifier.setTextContent(el);
+ tslQualifiers.appendChild(tslQualifier);
+
+ }
+
+ tslInfoElement.appendChild(tslQualifiers);
+
+ }
+
+ }
+
Element publicAuthorityElem =
isPublicAuthority
? response.createElementNS(MOA_NS_URI, "PublicAuthority")
@@ -215,6 +264,10 @@ public class ResponseBuilderUtils {
if (issuerCountryCodeElem != null)
x509DataElem.appendChild(issuerCountryCodeElem);
+ //add TSL infos to X509Date if TSL infos exists
+ if (tslInfoElement != null)
+ x509DataElem.appendChild(tslInfoElement);
+
signerInfoElem.appendChild(x509DataElem);
root.appendChild(signerInfoElem);
}