cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor JWS Utils code update
Date Tue, 21 Apr 2015 16:06:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7e9519ec8 -> b68c86145


Minor JWS Utils code update


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b68c8614
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b68c8614
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b68c8614

Branch: refs/heads/master
Commit: b68c86145839e2e453947835ec876be358e63700
Parents: 7e9519e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Apr 21 17:06:39 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Apr 21 17:06:39 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/rs/security/jose/jws/JwsUtils.java  | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b68c8614/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
index 5fc23db..a275a75 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
@@ -104,11 +104,11 @@ public final class JwsUtils {
         return new PrivateKeyJwsSignatureProvider(key, SignatureAlgorithm.getAlgorithm(algo));
     }
     public static JwsSignatureProvider getHmacSignatureProvider(byte[] key, String algo)
{
+        if (algo == null) {
+            LOG.warning("No signature algorithm was defined");
+            throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
+        }
         if (AlgorithmUtils.isHmacSign(algo)) {
-            if (algo == null) {
-                LOG.warning("No signature algorithm was defined");
-                throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
-            }
             return new HmacJwsSignatureProvider(key, SignatureAlgorithm.getAlgorithm(algo));
         }
         return null;
@@ -141,11 +141,12 @@ public final class JwsUtils {
         return new PublicKeyJwsSignatureVerifier(key, SignatureAlgorithm.getAlgorithm(algo));
     }
     public static JwsSignatureVerifier getHmacSignatureVerifier(byte[] key, String algo)
{
+        if (algo == null) {
+            LOG.warning("No signature algorithm was defined");
+            throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
+        }
+        
         if (AlgorithmUtils.isHmacSign(algo)) {
-            if (algo == null) {
-                LOG.warning("No signature algorithm was defined");
-                throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
-            }
             return new HmacJwsSignatureVerifier(key, SignatureAlgorithm.getAlgorithm(algo));
         }
         return null;


Mime
View raw message