aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/main/java
diff options
context:
space:
mode:
authorThomas <>2022-05-18 16:10:00 +0200
committerThomas <>2022-05-18 16:10:00 +0200
commitfb1498ec1c56b9d16d12f72bae37e6a02b505848 (patch)
tree6ba3ba045ed1e6558c7168344cedc154890397c8 /modules/authmodule-eIDAS-v2/src/main/java
parente35b0803da1183a4318cbc6fb46ca242c9199aed (diff)
downloadNational_eIDAS_Gateway-fb1498ec1c56b9d16d12f72bae37e6a02b505848.tar.gz
National_eIDAS_Gateway-fb1498ec1c56b9d16d12f72bae37e6a02b505848.tar.bz2
National_eIDAS_Gateway-fb1498ec1c56b9d16d12f72bae37e6a02b505848.zip
chore(register): update BM.I specific SOAP extension for transactionIds
- The original version was not successful because BM.I services remove the ID from request
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main/java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/BmiSoapTransactionHeaderInterceptor.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/BmiSoapTransactionHeaderInterceptor.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/BmiSoapTransactionHeaderInterceptor.java
index 86568796..d1de827b 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/BmiSoapTransactionHeaderInterceptor.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/BmiSoapTransactionHeaderInterceptor.java
@@ -25,7 +25,14 @@ import lombok.extern.slf4j.Slf4j;
*/
@Slf4j
public class BmiSoapTransactionHeaderInterceptor implements SOAPHandler<SOAPMessageContext> {
- private static final String ELEMENT = "Client-Request-Id";
+ private static final String AUTH_NS = "http://schemas.xmlsoap.org/ws/2002/04/secext";
+ private static final String AUTH_PREFIX = "wss";
+ private static final String AUTH_ELEMENT = "Security";
+
+
+ private static final String TRANS_ID_NS = "http://egov.gv.at/pvp1.xsd";
+ private static final String TRANS_IDPREFIX = "pvp";
+ private static final String TRANS_ID_ELEMENT = "Client-Request-Id";
@Override
public boolean handleMessage(SOAPMessageContext context) {
@@ -64,11 +71,15 @@ public class BmiSoapTransactionHeaderInterceptor implements SOAPHandler<SOAPMess
try {
SOAPMessage message = context.getMessage();
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
- SOAPFactory soapFactory = SOAPFactory.newInstance();
+ SOAPFactory soapFactory = SOAPFactory.newInstance();
+
+ // Creating WS-Security header element
+ SOAPElement wsSecHeaderElement = soapFactory.createElement(AUTH_ELEMENT, AUTH_PREFIX, AUTH_NS);
- // create header element
- SOAPElement transactionIdElm = soapFactory.createElement(ELEMENT);
- transactionIdElm.setTextContent(TransactionIdUtils.getTransactionId());
+ // create transactionId element
+ SOAPElement transactionIdElement = soapFactory.createElement(TRANS_ID_ELEMENT, TRANS_IDPREFIX, TRANS_ID_NS);
+ transactionIdElement.setTextContent(TransactionIdUtils.getTransactionId());
+ wsSecHeaderElement.addChildElement(transactionIdElement);
// inject header
SOAPHeader header = envelope.getHeader();
@@ -76,7 +87,7 @@ public class BmiSoapTransactionHeaderInterceptor implements SOAPHandler<SOAPMess
header = envelope.addHeader();
}
- header.addChildElement(transactionIdElm);
+ header.addChildElement(wsSecHeaderElement);
} catch (Exception e) {
log.warn("Can NOT inject TransactionId into SOAP message. Sending message without Id ...", e);
@@ -84,4 +95,4 @@ public class BmiSoapTransactionHeaderInterceptor implements SOAPHandler<SOAPMess
}
}
-}
+} \ No newline at end of file