You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/10/21 12:40:20 UTC
git commit: Support for simpler extraction of JWK sets with WebClient
Repository: cxf
Updated Branches:
refs/heads/master 00ee55be4 -> 70c985948
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/70c98594
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/70c98594
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/70c98594
Branch: refs/heads/master
Commit: 70c985948ca1e0ab42b8a0fa2294dd3df921f886
Parents: 00ee55b
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Tue Oct 21 11:40:03 2014 +0100
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Tue Oct 21 11:40:03 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/70c98594/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/70c98594/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);
+ }
+
+}