aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src
diff options
context:
space:
mode:
authorThomas <>2022-06-03 07:16:44 +0200
committerThomas <>2022-06-03 07:16:44 +0200
commit86da2487154632cfe5b280ffd87933d08571029b (patch)
tree5fd13d99feeb56ea512fb67c58692c63ec85e008 /modules/authmodule-eIDAS-v2/src
parent7100b253fe4712f6c820d11ed341366b3ec67623 (diff)
parent2eb2e6ddeb189ffb2996f3ec3b16244a67bd13e9 (diff)
downloadNational_eIDAS_Gateway-86da2487154632cfe5b280ffd87933d08571029b.tar.gz
National_eIDAS_Gateway-86da2487154632cfe5b280ffd87933d08571029b.tar.bz2
National_eIDAS_Gateway-86da2487154632cfe5b280ffd87933d08571029b.zip
Merge branch 'feature/eidasnode_v2.6' into feature/ms_proxy_before_refactoring
# Conflicts: # basicConfig/templates/error_message.html # modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/builder/AuthenticationDataBuilder.java
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src')
-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