cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Fixing Jwt Grant
Date Fri, 19 Jun 2015 15:24:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 785955e8a -> 72f81630f


Fixing Jwt Grant


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

Branch: refs/heads/master
Commit: 72f81630fba3c74d03e99e724f03c2cd07e0d3dc
Parents: 785955e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jun 19 16:24:22 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jun 19 16:24:22 2015 +0100

----------------------------------------------------------------------
 .../json/JsonMapObjectReaderWriter.java         |  9 ++++++++-
 .../oauth2/grants/jwt/JwtBearerGrant.java       |  6 +++---
 .../provider/JoseSessionTokenProvider.java      | 20 +++++++++++++++-----
 3 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/72f81630/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
index 827d266..e7cfd61 100644
--- a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
+++ b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxrs.provider.json;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
 import java.util.Collection;
@@ -29,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.IOUtils;
 
 
 
@@ -123,6 +125,9 @@ public class JsonMapObjectReaderWriter {
             out.append("\r\n ");
         }
     }
+    public JsonMapObject fromJsonToJsonObject(InputStream is) throws IOException {
+        return fromJsonToJsonObject(IOUtils.toString(is));
+    }
     public JsonMapObject fromJsonToJsonObject(String json) {
         JsonMapObject obj = new JsonMapObject();
         fromJson(obj, json);
@@ -133,7 +138,9 @@ public class JsonMapObjectReaderWriter {
         JsonObjectSettable settable = new JsonObjectSettable(obj);
         readJsonObjectAsSettable(settable, theJson.substring(1, theJson.length() - 1));
     }
-    
+    public Map<String, Object> fromJson(InputStream is) throws IOException {
+        return fromJson(IOUtils.toString(is));
+    }
     public Map<String, Object> fromJson(String json) {
         String theJson = json.trim();
         MapSettable nextMap = new MapSettable();

http://git-wip-us.apache.org/repos/asf/cxf/blob/72f81630/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrant.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrant.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrant.java
index a528705..f25942a 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrant.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrant.java
@@ -24,15 +24,15 @@ public class JwtBearerGrant extends AbstractJwtBearerGrant {
     private static final long serialVersionUID = -7296527609343431294L;
 
     public JwtBearerGrant(String assertion) {
-        this(assertion, false);
+        this(assertion, true);
     }
     
     public JwtBearerGrant(String assertion, boolean encoded) {
-        this(assertion, false, null);
+        this(assertion, encoded, null);
     }
     
     public JwtBearerGrant(String assertion, String scope) {
-        this(assertion, false, scope);
+        this(assertion, true, scope);
     }
     
     public JwtBearerGrant(String assertion, boolean encoded, String scope) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/72f81630/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JoseSessionTokenProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JoseSessionTokenProvider.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JoseSessionTokenProvider.java
index e9cf678..9ef260c 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JoseSessionTokenProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JoseSessionTokenProvider.java
@@ -139,11 +139,21 @@ public class JoseSessionTokenProvider implements SessionAuthenticityTokenProvide
         String[] parts = ModelEncryptionSupport.getParts(stateString);
         OAuthRedirectionState state = new OAuthRedirectionState();
         state.setClientId(parts[0]);
-        state.setAudience(parts[1]);
-        state.setClientCodeChallenge(parts[2]);
-        state.setState(parts[3]);
-        state.setProposedScope(parts[4]);
-        state.setRedirectUri(parts[5]);
+        if (!StringUtils.isEmpty(parts[1])) {
+            state.setAudience(parts[1]);
+        }
+        if (!StringUtils.isEmpty(parts[2])) {
+            state.setClientCodeChallenge(parts[2]);
+        }
+        if (!StringUtils.isEmpty(parts[3])) {
+            state.setState(parts[3]);
+        }
+        if (!StringUtils.isEmpty(parts[4])) {
+            state.setProposedScope(parts[4]);
+        }
+        if (!StringUtils.isEmpty(parts[5])) {
+            state.setRedirectUri(parts[5]);
+        }
         return state;
     }
     protected String convertStateToString(OAuthRedirectionState secData) {


Mime
View raw message