ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1653613 - /webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
Date Wed, 21 Jan 2015 17:34:38 GMT
Author: coheigea
Date: Wed Jan 21 17:34:37 2015
New Revision: 1653613

URL: http://svn.apache.org/r1653613
Log:
Avoid some potential NPEs

Modified:
    webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java

Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java?rev=1653613&r1=1653612&r2=1653613&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
Wed Jan 21 17:34:37 2015
@@ -524,7 +524,7 @@ public class SamlAssertionWrapper {
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
         cryptoType.setAlias(issuerKeyName);
         X509Certificate[] issuerCerts = issuerCrypto.getX509Certificates(cryptoType);
-        if (issuerCerts == null) {
+        if (issuerCerts == null || issuerCerts.length == 0) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
                     "No issuer certs were found to sign the SAML Assertion using issuer name:
"
                             + issuerKeyName);
@@ -548,6 +548,10 @@ public class SamlAssertionWrapper {
         } catch (Exception ex) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex);
         }
+        if (privateKey == null) {
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+                    "No private key was found using issuer name: " + issuerKeyName);
+        }
 
         signature.setSignatureAlgorithm(sigAlgo);
 



Mime
View raw message