You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/04/02 21:50:07 UTC

[1/4] incubator-usergrid git commit: Fix ping indentity validation be POSTing a form rather than query params

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 <rb...@apigee.com>
Authored: Fri Mar 27 16:54:41 2015 -0400
Committer: ryan bridges <rb...@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();
 


[2/4] incubator-usergrid git commit: Fix for https://issues.apache.org/jira/browse/USERGRID-530

Posted by sn...@apache.org.
Fix for https://issues.apache.org/jira/browse/USERGRID-530


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

Branch: refs/heads/master
Commit: 982d851628b3c1e5745840e86c220b9d773494d8
Parents: 84eb59f
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Apr 1 12:16:40 2015 -0400
Committer: ryan bridges <rb...@apigee.com>
Committed: Thu Apr 2 10:19:07 2015 -0400

----------------------------------------------------------------------
 .../rest/applications/ServiceResource.java      |  13 ++-
 .../applications/assets/AssetResourceIT.java    | 107 +++++++++++++++++++
 2 files changed, 117 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/982d8516/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
index 8fd57bf..d5ef311 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
@@ -387,9 +387,16 @@ public class ServiceResource extends AbstractContextResource {
 
         ServiceResults sr = executeServiceRequest( ui, response, ServiceAction.DELETE, null );
 
-        for ( Entity entity : sr.getEntities() ) {
-            if ( entity.getProperty( AssetUtils.FILE_METADATA ) != null ) {
-                binaryStore.delete( services.getApplicationId(), entity );
+        // if we deleted an entity (and not a connection or collection) then
+        // we may need to clean up binary asset data associated with that entity
+
+        if (    !sr.getResultsType().equals( ServiceResults.Type.CONNECTION )
+             && !sr.getResultsType().equals( ServiceResults.Type.COLLECTION )) {
+
+            for ( Entity entity : sr.getEntities() ) {
+                if ( entity.getProperty( AssetUtils.FILE_METADATA ) != null ) {
+                    binaryStore.delete( services.getApplicationId(), entity );
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/982d8516/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
index deab062..b41659d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
@@ -17,6 +17,7 @@
 package org.apache.usergrid.rest.applications.assets;
 
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 import java.util.UUID;
@@ -40,6 +41,7 @@ import org.apache.commons.io.IOUtils;
 import com.sun.jersey.multipart.FormDataMultiPart;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 
@@ -273,4 +275,109 @@ public class AssetResourceIT extends AbstractRestIT {
         node = resource().path( "/test-organization/test-app/foos/" + uuid ).queryParam( "access_token", access_token )
                 .accept( MediaType.APPLICATION_JSON_TYPE ).delete( JsonNode.class );
     }
+
+
+    /**
+     * Deleting a connection to an asset should not delete the asset or the asset's data
+     */
+    @Test
+    public void deleteConnectionToAsset() throws IOException {
+
+        UserRepo.INSTANCE.load( resource(), access_token );
+
+        final String uuid;
+
+        // create the entity that will be the asset, an image
+
+        Map<String, String> payload = hashMap("name", "cassandra_eye.jpg");
+
+        JsonNode node = resource().path("/test-organization/test-app/foos")
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .post(JsonNode.class, payload);
+        JsonNode idNode = node.get("entities").get(0).get("uuid");
+        uuid = idNode.getTextValue();
+
+        // post image data to the asset entity
+
+        byte[] data = IOUtils.toByteArray(this.getClass().getResourceAsStream("/cassandra_eye.jpg"));
+        resource().path("/test-organization/test-app/foos/" + uuid)
+                .queryParam("access_token", access_token)
+                .type(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+                .put(data);
+
+        // create an imagegallery entity
+
+        Map<String, String> imageGalleryPayload = hashMap("name", "my image gallery");
+
+        JsonNode imageGalleryNode = resource().path("/test-organization/test-app/imagegalleries")
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .post(JsonNode.class, imageGalleryPayload);
+
+        JsonNode imageGalleryIdNode = imageGalleryNode.get("entities").get(0).get("uuid");
+        String imageGalleryId = imageGalleryIdNode.getTextValue();
+
+        // connect imagegallery to asset
+
+        JsonNode connectNode = resource()
+                .path("/test-organization/test-app/imagegalleries/" + imageGalleryId + "/contains/" + uuid)
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .post(JsonNode.class);
+
+        // verify connection from imagegallery to asset
+
+        JsonNode listConnectionsNode = resource()
+                .path("/test-organization/test-app/imagegalleries/" + imageGalleryId + "/contains/")
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .get(JsonNode.class);
+        assertEquals(uuid, listConnectionsNode.get("entities").get(0).get("uuid").getTextValue());
+
+        // delete the connection
+
+        resource().path("/test-organization/test-app/imagegalleries/" + imageGalleryId + "/contains/" + uuid)
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .delete();
+
+        // verify that connection is gone
+
+        listConnectionsNode = resource()
+                .path("/test-organization/test-app/imagegalleries/" + imageGalleryId + "/contains/")
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .get(JsonNode.class);
+        assertFalse(listConnectionsNode.get("entities").getElements().hasNext());
+
+        // asset should still be there
+
+        JsonNode assetNode = resource().path("/test-organization/test-app/foos/" + uuid)
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_JSON_TYPE)
+                .get(JsonNode.class);
+
+        logNode(assetNode);
+        Assert.assertEquals("image/jpeg", assetNode.findValue(AssetUtils.CONTENT_TYPE).getTextValue());
+        Assert.assertEquals(7979, assetNode.findValue("content-length").getIntValue());
+        JsonNode assetIdNode = assetNode.get("entities").get(0).get("uuid");
+        assertEquals(uuid, assetIdNode.getTextValue());
+
+        // asset data should still be there
+
+        InputStream assetIs = resource().path("/test-organization/test-app/foos/" + uuid)
+                .queryParam("access_token", access_token)
+                .accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+                .get(InputStream.class);
+
+        byte[] foundData = IOUtils.toByteArray(assetIs);
+        assertEquals(7979, foundData.length);
+    }
 }


[4/4] incubator-usergrid git commit: Moving our version back to 1.0.1-SNAPSHOT as it should be.

Posted by sn...@apache.org.
Moving our version back to 1.0.1-SNAPSHOT as it should be.


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

Branch: refs/heads/master
Commit: 89d9c6f62bbd94d26cf6c3b7b9d66ca6e1ff53f4
Parents: 6391e1e
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Apr 2 15:49:50 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Apr 2 15:49:50 2015 -0400

----------------------------------------------------------------------
 stack/config/pom.xml         | 2 +-
 stack/core/pom.xml           | 2 +-
 stack/java-sdk-old/pom.xml   | 2 +-
 stack/mongo-emulator/pom.xml | 2 +-
 stack/pom.xml                | 2 +-
 stack/services/pom.xml       | 2 +-
 stack/test-utils/pom.xml     | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/config/pom.xml
----------------------------------------------------------------------
diff --git a/stack/config/pom.xml b/stack/config/pom.xml
index 0ea0048..7c7105f 100644
--- a/stack/config/pom.xml
+++ b/stack/config/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>usergrid</artifactId>
-    <version>1.0.1-1-SNAPSHOT</version>
+    <version>1.0.1-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 2db39fb..d3e3e4e 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>usergrid</artifactId>
-    <version>1.0.1-1-SNAPSHOT</version>
+    <version>1.0.1-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/java-sdk-old/pom.xml
----------------------------------------------------------------------
diff --git a/stack/java-sdk-old/pom.xml b/stack/java-sdk-old/pom.xml
index 09b4c05..faa4b88 100644
--- a/stack/java-sdk-old/pom.xml
+++ b/stack/java-sdk-old/pom.xml
@@ -32,7 +32,7 @@
     <parent>
         <groupId>org.apache.usergrid</groupId>
         <artifactId>usergrid</artifactId>
-        <version>1.0.1-1-SNAPSHOT</version>
+        <version>1.0.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 	

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/mongo-emulator/pom.xml
----------------------------------------------------------------------
diff --git a/stack/mongo-emulator/pom.xml b/stack/mongo-emulator/pom.xml
index 8d1763c..7f03b61 100644
--- a/stack/mongo-emulator/pom.xml
+++ b/stack/mongo-emulator/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>usergrid</artifactId>
-    <version>1.0.1-1-SNAPSHOT</version>
+    <version>1.0.1-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 6406474..9bc0b06 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -27,7 +27,7 @@
 
   <groupId>org.apache.usergrid</groupId>
   <artifactId>usergrid</artifactId>
-  <version>1.0.1-1-SNAPSHOT</version>
+  <version>1.0.1-SNAPSHOT</version>
   <name>Usergrid Parent</name>
   <description>Parent module for the Apache Usergrid Project</description>
   <packaging>pom</packaging>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index c7e0084..6b1bcdc 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>usergrid</artifactId>
-    <version>1.0.1-1-SNAPSHOT</version>
+    <version>1.0.1-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89d9c6f6/stack/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/stack/test-utils/pom.xml b/stack/test-utils/pom.xml
index 862aa78..daa9f98 100644
--- a/stack/test-utils/pom.xml
+++ b/stack/test-utils/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>usergrid</artifactId>
-    <version>1.0.1-1-SNAPSHOT</version>
+    <version>1.0.1-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
 


[3/4] incubator-usergrid git commit: Merge branch 'post-content-length-fix'

Posted by sn...@apache.org.
Merge branch 'post-content-length-fix'


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

Branch: refs/heads/master
Commit: 6391e1e70514068354351c528d5cadecd5f169b8
Parents: 5000c33 982d851
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Apr 2 11:03:42 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Apr 2 11:03:42 2015 -0400

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