cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1470875 - in /cxf/branches/2.7.x-fixes/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:16:04 GMT
Author: coheigea
Date: Tue Apr 23 10:16:04 2013
New Revision: 1470875

URL: http://svn.apache.org/r1470875
Log:
Merged revisions 1470873 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1470873 | coheigea | 2013-04-23 11:13:51 +0100 (Tue, 23 Apr 2013) | 2 lines

  [CXF-4978] - Only encrypt an issued token if we have a matching key

........

Modified:
    cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
    cxf/branches/2.7.x-fixes/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java

Modified: cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java?rev=1470875&r1=1470874&r2=1470875&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
(original)
+++ cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
Tue Apr 23 10:16:04 2013
@@ -304,7 +304,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/2.7.x-fixes/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java?rev=1470875&r1=1470874&r2=1470875&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
(original)
+++ cxf/branches/2.7.x-fixes/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueEncryptedUnitTest.java
Tue Apr 23 10:16:04 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