cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1460170 - /cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java
Date Sat, 23 Mar 2013 15:08:48 GMT
Author: ashakirin
Date: Sat Mar 23 15:08:48 2013
New Revision: 1460170

URL: http://svn.apache.org/r1460170
Log:
Backmerged [CXF-4897]: check certificates array for null and 0 length

Modified:
    cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java

Modified: cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java?rev=1460170&r1=1460169&r2=1460170&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java
(original)
+++ cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java
Sat Mar 23 15:08:48 2013
@@ -123,9 +123,13 @@ public class DefaultSubjectProvider impl
             }
             cryptoType.setAlias(encryptionName);
             try {
-                X509Certificate certificate = crypto.getX509Certificates(cryptoType)[0];
+                X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
+                if (certs == null || certs.length <= 0) {
+                    new STSException("Encryption certificate is not found for alias: " +
encryptionName,
+                                     STSException.REQUEST_FAILED);
+                }
                 KeyInfoBean keyInfo = 
-                    createKeyInfo(certificate, secret, doc, encryptionProperties, crypto);
+                    createKeyInfo(certs[0], secret, doc, encryptionProperties, crypto);
                 subjectBean.setKeyInfo(keyInfo);
             } catch (WSSecurityException ex) {
                 LOG.log(Level.WARNING, "", ex);



Mime
View raw message