cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Minor optimization to JwsJsonConsumer
Date Wed, 22 Oct 2014 18:34:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 29789aac5 -> 5e2b1fa9d


Minor optimization to JwsJsonConsumer


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

Branch: refs/heads/master
Commit: 5e2b1fa9d60ca00133a0f49a9ee3935793bc7c24
Parents: 29789aa
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Oct 22 19:34:24 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Oct 22 19:34:24 2014 +0100

----------------------------------------------------------------------
 .../rs/security/jose/jws/JwsJsonConsumer.java   | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5e2b1fa9/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
index b44ecc8..b1d2663 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
@@ -94,9 +94,13 @@ public class JwsJsonConsumer {
         return JwsUtils.getJwsJsonSignatureMap(signatureEntries);
     }
     public boolean verifySignatureWith(JwsSignatureVerifier validator) {
-        for (JwsJsonSignatureEntry signatureEntry : signatureEntries) {
-            if (signatureEntry.verifySignatureWith(validator)) {
-                return true;
+        List<JwsJsonSignatureEntry> theSignatureEntries = 
+            getSignatureEntryMap().get(validator.getAlgorithm());
+        if (theSignatureEntries != null) {
+            for (JwsJsonSignatureEntry signatureEntry : theSignatureEntries) {
+                if (signatureEntry.verifySignatureWith(validator)) {
+                    return true;
+                }
             }
         }
         return false;
@@ -117,11 +121,15 @@ public class JwsJsonConsumer {
         List<JwsJsonSignatureEntry> validatedSignatures = new LinkedList<JwsJsonSignatureEntry>();
         for (JwsSignatureVerifier validator : validators) {
             boolean validated = false;
-            for (JwsJsonSignatureEntry sigEntry : signatureEntries) {
-                if (sigEntry.verifySignatureWith(validator)) {     
-                    validatedSignatures.add(sigEntry);
-                    validated = true;
-                    break;
+            List<JwsJsonSignatureEntry> theSignatureEntries = 
+                getSignatureEntryMap().get(validator.getAlgorithm());
+            if (theSignatureEntries != null) {
+                for (JwsJsonSignatureEntry sigEntry : theSignatureEntries) {
+                    if (sigEntry.verifySignatureWith(validator)) {     
+                        validatedSignatures.add(sigEntry);
+                        validated = true;
+                        break;
+                    }
                 }
             }
             if (!validated) {


Mime
View raw message