cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Support for simpler extraction of JWK sets with WebClient
Date Tue, 21 Oct 2014 10:43:46 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 203b64d17 -> 61a5ee1a8


Support for simpler extraction of JWK sets with WebClient


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

Branch: refs/heads/3.0.x-fixes
Commit: 61a5ee1a8a82211ba6b4d8d38beca85c6d0361fd
Parents: 203b64d
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Oct 21 11:40:03 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Oct 21 11:43:25 2014 +0100

----------------------------------------------------------------------
 .../provider/json/JsonMapObjectProvider.java    |  5 +-
 .../jose/jaxrs/JsonWebKeysProvider.java         | 48 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/61a5ee1a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectProvider.java
b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectProvider.java
index 9de4059..a8b68ad 100644
--- a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectProvider.java
+++ b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectProvider.java
@@ -22,9 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Type;
-import java.util.Map;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
@@ -75,8 +73,7 @@ public class JsonMapObjectProvider implements MessageBodyReader<JsonMapObject>,
             return obj;
         } else {
             try {
-                Constructor<?> c = cls.getConstructor(Map.class);
-                JsonMapObject actualObj = (JsonMapObject)c.newInstance();
+                JsonMapObject actualObj = (JsonMapObject)cls.newInstance();
                 actualObj.values = obj.values;
                 actualObj.updateCount = obj.updateCount;
                 return actualObj;

http://git-wip-us.apache.org/repos/asf/cxf/blob/61a5ee1a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JsonWebKeysProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JsonWebKeysProvider.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JsonWebKeysProvider.java
new file mode 100644
index 0000000..a877925
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JsonWebKeysProvider.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+
+import org.apache.cxf.rs.security.jose.jwk.JsonWebKeys;
+import org.apache.cxf.rs.security.jose.jwk.JwkUtils;
+
+public class JsonWebKeysProvider implements MessageBodyReader<JsonWebKeys> {
+    
+    @Override
+    public boolean isReadable(Class<?> cls, Type type, Annotation[] anns, MediaType
mt) {
+        return cls == JsonWebKeys.class;
+    }
+
+    @Override
+    public JsonWebKeys readFrom(Class<JsonWebKeys> cls, Type t, Annotation[] anns,
MediaType mt,
+                             MultivaluedMap<String, String> headers, InputStream is)
throws IOException,
+        WebApplicationException {
+        return JwkUtils.readJwkSet(is);
+    }
+    
+}


Mime
View raw message