oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1552708 - in /oltu/trunk/oauth-2.0/jwt/src: main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java
Date Fri, 20 Dec 2013 15:59:22 GMT
Author: asanso
Date: Fri Dec 20 15:59:21 2013
New Revision: 1552708

URL: http://svn.apache.org/r1552708
Log:
OLTU-131 - Signature parsing from access token is broken for character encodings that are
not single-byte

*  apply patch from Andrei Dulvac (thanks !!)

Modified:
    oltu/trunk/oauth-2.0/jwt/src/main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java
    oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java
    oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java

Modified: oltu/trunk/oauth-2.0/jwt/src/main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/jwt/src/main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java?rev=1552708&r1=1552707&r2=1552708&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/jwt/src/main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java (original)
+++ oltu/trunk/oauth-2.0/jwt/src/main/java/org/apache/oltu/oauth2/jwt/io/JWTReader.java Fri
Dec 20 15:59:21 2013
@@ -25,13 +25,13 @@ import org.apache.oltu.oauth2.jwt.JWT;
 public final class JWTReader extends TokenReader<JWT> {
 
     @Override
-    protected JWT build(String rawString, String decodedHeader, String decodedBody, String
decodedSignature) {
+    protected JWT build(String rawString, String decodedHeader, String decodedBody, String
encodedSignature) {
         JWT.Builder jwtBuilder = new JWT.Builder(rawString);
 
         new JWTHeaderParser(jwtBuilder).read(decodedHeader);
         new JWTClaimsSetParser(jwtBuilder).read(decodedBody);
 
-        return jwtBuilder.setSignature(decodedSignature).build();
+        return jwtBuilder.setSignature(encodedSignature).build();
     }
 
 }

Modified: oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java?rev=1552708&r1=1552707&r2=1552708&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java
(original)
+++ oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/IOTestCaseConstants.java
Fri Dec 20 15:59:21 2013
@@ -30,8 +30,8 @@ interface IOTestCaseConstants {
                             + "LmNvbSIsInRva2VuX2hhc2giOiJMMkk3N2dpQkxrMFJTczB6UTFTdkNBIiwiYXRfaGFzaCI6Ikwy"
                             + "STc3Z2lCTGswUlNzMHpRMVN2Q0EifQ"
                             + "."
-                            + "WFdZaTVaajFZV0FNR0ltbF9mdG9Bd212VzFZN29leWJMQ3B6UXJKVnVXSnBTOEw4VmQyVEwtUlRJ"
-                            + "T0VWRzAzVkE3ZTBfLV9mck51dzdNeFVnVkVnaDhHLU5uYmtfYmFKNmtfM3c1YzFTS0ZhbUZpSEhE"
-                            + "b0tMRmhydDFZOEpLU3VHd0UwMlYtcHg0Q24wZFJBUUFjMUlONUNVNndxQ3JZSzBwLWZ2X2Z2eTI4";
+                            + "XWYi5Zj1YWAMGIml_ftoAwmvW1Y7oeybLCpzQrJVuWJpS8L8Vd2TL-RTIOEVG03VA7e0_-_frNuw"
+                            + "7MxUgVEgh8G-Nnbk_baJ6k_3w5c1SKFamFiHHDoKLFhrt1Y8JKSuGwE02V-px4Cn0dRAQAc1IN5C"
+                            + "U6wqCrYK0p-fv_fvy28";
 
 }

Modified: oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java?rev=1552708&r1=1552707&r2=1552708&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java
(original)
+++ oltu/trunk/oauth-2.0/jwt/src/test/java/org/apache/oltu/oauth2/jwt/io/JWTWriterTestCase.java
Fri Dec 20 15:59:21 2013
@@ -46,7 +46,7 @@ public final class JWTWriterTestCase imp
                           // signature
                           .setSignature("XWYi5Zj1YWAMGIml_ftoAwmvW1Y7oeybLCpzQrJVuWJpS8L8Vd2TL-RTIOEVG03VA7e0_-_frNuw7MxUgVEgh8G-Nnbk_baJ6k_3w5c1SKFamFiHHDoKLFhrt1Y8JKSuGwE02V-px4Cn0dRAQAc1IN5CU6wqCrYK0p-fv_fvy28")
                           .build();
-        String encodedJWT = new JWTWriter().write(jwt).replaceAll("\r?\n", "");;
+        String encodedJWT = new JWTWriter().write(jwt);
         assertEquals(JWT, encodedJWT);
     }
 



Mime
View raw message