usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [1/4] incubator-usergrid git commit: Fix ping indentity validation be POSTing a form rather than query params
Date Thu, 02 Apr 2015 19:50:07 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/master 5000c3324 -> 89d9c6f62


Fix ping indentity validation be POSTing a form rather than query params


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/84eb59f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/84eb59f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/84eb59f0

Branch: refs/heads/master
Commit: 84eb59f0bf3f439ee3209a14cca34754de9000e0
Parents: 4d7be24
Author: ryan bridges <rbridges@apigee.com>
Authored: Fri Mar 27 16:54:41 2015 -0400
Committer: ryan bridges <rbridges@apigee.com>
Committed: Fri Mar 27 16:54:41 2015 -0400

----------------------------------------------------------------------
 .../security/providers/AbstractProvider.java        |  6 ++++++
 .../security/providers/PingIdentityProvider.java    | 16 ++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/84eb59f0/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
index 05e12a8..54f765c 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.security.providers;
 
 import java.util.Map;
 
+import com.sun.jersey.core.util.MultivaluedMapImpl;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManager;
 
@@ -27,6 +28,8 @@ import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.json.JSONConfiguration;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 
 /** @author zznate */
 public abstract class AbstractProvider implements SignInAsProvider {
@@ -53,6 +56,9 @@ public abstract class AbstractProvider implements SignInAsProvider {
 
     public abstract void saveToConfiguration( Map<String, Object> config );
 
+    protected MultivaluedMap getMultivaluedMapImpl() {
+      return new MultivaluedMapImpl();
+    }
 
     /** Encapsulates the dictionary lookup for any configuration required */
     protected Map<Object, Object> loadConfigurationFor( String providerKey ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/84eb59f0/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
index 0d01fe7..3ab51ca 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
 
 import org.codehaus.jackson.JsonNode;
 import org.slf4j.Logger;
@@ -122,12 +123,15 @@ public class PingIdentityProvider extends AbstractProvider {
     @Override
     Map<String, Object> userFromResource( String externalToken ) {
 
-        JsonNode node = client.resource( apiUrl )
-                              .queryParam( "grant_type", "urn:pingidentity.com:oauth2:grant_type:validate_bearer"
)
-                              .queryParam( "client_secret", clientSecret ).queryParam( "client_id",
clientId )
-                              .queryParam( "token", externalToken ).type( MediaType.APPLICATION_FORM_URLENCODED_TYPE
)
-                              .header("Content-Length", "0")
-                              .post( JsonNode.class );
+      MultivaluedMap<String, String> formData =  getMultivaluedMapImpl();
+      formData.add("grant_type", "urn:pingidentity.com:oauth2:grant_type:validate_bearer");
+      formData.add("client_id", clientId);
+      formData.add("client_secret", clientSecret);
+      formData.add("token", externalToken);
+
+      JsonNode node = client.resource( apiUrl )
+          .type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
+          .post( JsonNode.class, formData );
 
         String rawEmail = node.get( "access_token" ).get( "subject" ).asText();
 


Mime
View raw message