cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1470874 - in /cxf/branches/wss4j2.0-port/services/sts/sts-core/src: main/java/org/apache/cxf/sts/operation/AbstractOperation.java test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
Date Tue, 23 Apr 2013 10:14:25 GMT
Author: coheigea
Date: Tue Apr 23 10:14:24 2013
New Revision: 1470874

URL: http://svn.apache.org/r1470874
Log:
[CXF-4978] - Only encrypt an issued token if we have a matching key

Modified:
    cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
    cxf/branches/wss4j2.0-port/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java

Modified: cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java?rev=1470874&r1=1470873&r2=1470874&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
(original)
+++ cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
Tue Apr 23 10:14:24 2013
@@ -301,7 +301,8 @@ public abstract class AbstractOperation 
             name = stsProperties.getEncryptionUsername();
         }
         if (name == null) {
-            throw new STSException("No encryption alias is configured", STSException.REQUEST_FAILED);
+            LOG.fine("No encryption alias is configured");
+            return element;
         }
         
         // Get the encryption algorithm to use

Modified: cxf/branches/wss4j2.0-port/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java?rev=1470874&r1=1470873&r2=1470874&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
(original)
+++ cxf/branches/wss4j2.0-port/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
Tue Apr 23 10:14:24 2013
@@ -157,22 +157,19 @@ public class IssueEncryptedUnitTest exte
         WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
         WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
         
-        // Issue a token - this will fail as the STSProperties has no encryption name specified
-        try {
+        // Issue a token - as no encryption name has been specified the token will not be
encrypted
+        RequestSecurityTokenResponseCollectionType response = 
             issueOperation.issue(request, webServiceContext);
-            fail("Failure expected on no encryption name");
-        } catch (STSException ex) {
-            // expected
-        }
+        List<RequestSecurityTokenResponseType> securityTokenResponse = 
+            response.getRequestSecurityTokenResponse();
+        assertTrue(!securityTokenResponse.isEmpty());
         
         encryptionProperties.setEncryptionName("myservicekey");
         service.setEncryptionProperties(encryptionProperties);
         
-        // Issue a token - this should work as the Service is configured with an EncryptionName
-        RequestSecurityTokenResponseCollectionType response = 
-            issueOperation.issue(request, webServiceContext);
-        List<RequestSecurityTokenResponseType> securityTokenResponse = 
-            response.getRequestSecurityTokenResponse();
+        // Issue a (encrypted) token
+        response = issueOperation.issue(request, webServiceContext);
+        securityTokenResponse = response.getRequestSecurityTokenResponse();
         assertTrue(!securityTokenResponse.isEmpty());
     }
     



Mime
View raw message