You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oltu.apache.org by si...@apache.org on 2013/09/20 09:24:55 UTC

svn commit: r1524921 - /oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java

Author: simonetripodi
Date: Fri Sep 20 07:24:55 2013
New Revision: 1524921

URL: http://svn.apache.org/r1524921
Log:
OLTU-118 - Implement JWS of the JOSE working group

verification method has to make sure that JWS has a payload and a signature in order to execute the verify method

Modified:
    oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java

Modified: oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java
URL: http://svn.apache.org/viewvc/oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java?rev=1524921&r1=1524920&r2=1524921&view=diff
==============================================================================
--- oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java (original)
+++ oltu/trunk/jose/jws/src/main/java/org/apache/oltu/jose/jws/JWS.java Fri Sep 20 07:24:55 2013
@@ -70,6 +70,12 @@ public class JWS {
         if (header == null || header.getAlgorithm() == null) {
             throw new IllegalStateException("JWS token must have a valid JSON header with specified algorithm.");
         }
+        if (payload == null) {
+            throw new IllegalStateException("JWS token must have a payload.");
+        }
+        if (signature == null) {
+            throw new IllegalStateException("JWS token must have a signature to be verified.");
+        }
 
         if (!header.getAlgorithm().equalsIgnoreCase(method.getAlgorithm())) {
             throw new IllegalArgumentException("Impossible to verify current JWS signature with algorithm '"