From f794e015ac2cc8b927b7b07d152dad04d5d20b13 Mon Sep 17 00:00:00 2001 From: Colm O hEigeartaigh Date: Wed, 23 Nov 2016 12:30:24 +0000 Subject: [PATCH] Fixing merge --- .../SymmetricBindingHandler.java | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java index 0237ab0edaa..97e0b9ca154 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java @@ -928,8 +928,7 @@ private String setupUTDerivedKey(UsernameToken sigToken) throws WSSecurityExcept return id; } -<<<<<<< HEAD - private String getEncryptedKey() { + private SecurityToken getEncryptedKey() { List results = CastUtils.cast((List)message.getExchange().getInMessage() .get(WSHandlerConstants.RECV_RESULTS)); @@ -946,32 +945,14 @@ private String getEncryptedKey() { Date created = new Date(); Date expires = new Date(); expires.setTime(created.getTime() + 300000); - SecurityToken tempTok = new SecurityToken(encryptedKeyID, created, expires); - tempTok.setSecret((byte[])wser.get(WSSecurityEngineResult.TAG_SECRET)); - tempTok.setSHA1(getSHA1((byte[])wser + SecurityToken securityToken = new SecurityToken(encryptedKeyID, created, expires); + securityToken.setSecret((byte[])wser.get(WSSecurityEngineResult.TAG_SECRET)); + securityToken.setSHA1(getSHA1((byte[])wser .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY))); - tokenStore.add(tempTok); - return encryptedKeyID; + return securityToken; } } -======= - private SecurityToken getEncryptedKey() { - WSSecurityEngineResult encryptedKeyResult = getEncryptedKeyResult(); - if (encryptedKeyResult != null) { - // Store it in the cache - Date created = new Date(); - Date expires = new Date(); - expires.setTime(created.getTime() + WSS4JUtils.getSecurityTokenLifetime(message)); - - String encryptedKeyID = (String)encryptedKeyResult.get(WSSecurityEngineResult.TAG_ID); - SecurityToken securityToken = new SecurityToken(encryptedKeyID, created, expires); - securityToken.setSecret((byte[])encryptedKeyResult.get(WSSecurityEngineResult.TAG_SECRET)); - securityToken.setSHA1(getSHA1((byte[])encryptedKeyResult - .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY))); - - return securityToken; ->>>>>>> 0769de2... CXF-7148 - Race Condition while handling symmetric key in SymmetricBindingHandler } return null; } @@ -993,15 +974,9 @@ private SecurityToken getUTDerivedKey() throws WSSecurityException { } Date created = new Date(); Date expires = new Date(); -<<<<<<< HEAD expires.setTime(created.getTime() + 300000); - SecurityToken tempTok = new SecurityToken(utID, created, expires); - -======= - expires.setTime(created.getTime() + WSS4JUtils.getSecurityTokenLifetime(message)); SecurityToken securityToken = new SecurityToken(utID, created, expires); - ->>>>>>> 0769de2... CXF-7148 - Race Condition while handling symmetric key in SymmetricBindingHandler + byte[] secret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET); securityToken.setSecret(secret);