usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [1/2] incubator-usergrid git commit: USERGRID-457 - Update PingIdentityProvider to send parameters as formparams instead of queryparams.
Date Fri, 17 Apr 2015 20:24:00 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 5a60f1f64 -> 945fa084e


USERGRID-457 - Update PingIdentityProvider to send parameters as formparams instead of queryparams.


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

Branch: refs/heads/two-dot-o-dev
Commit: 0c4b7c1cb2fcdc997659cd7f3056840d6b90db45
Parents: 2d1c8b8
Author: Michael Russo <mrusso@apigee.com>
Authored: Thu Mar 26 22:19:13 2015 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Thu Mar 26 22:19:13 2015 -0700

----------------------------------------------------------------------
 .../usergrid/security/providers/AbstractProvider.java |  6 ++++++
 .../security/providers/PingIdentityProvider.java      | 14 +++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0c4b7c1c/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..3bc52ea 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
@@ -26,6 +26,9 @@ import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+
+import javax.ws.rs.core.MultivaluedMap;
 
 
 /** @author zznate */
@@ -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/0c4b7c1c/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 3c8d209..bae0372 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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -123,12 +124,15 @@ public class PingIdentityProvider extends AbstractProvider {
     @Override
     Map<String, Object> userFromResource( String externalToken ) {
 
+        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 )
-                              .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 );
+                              .type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
+                              .post( JsonNode.class, formData );
 
         String rawEmail = node.get( "access_token" ).get( "subject" ).asText();
 


Mime
View raw message