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

incubator-ignite git commit: #ignite-961: add test for security.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-961-master ed1482934 -> cab277b85


#ignite-961: add test for security.


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

Branch: refs/heads/ignite-961-master
Commit: cab277b8500fc69db5e2ec6f87ebcc5190367ad8
Parents: ed14829
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jul 21 13:02:23 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jul 21 13:02:23 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     |  4 +--
 .../processors/rest/GridRestProcessor.java      | 13 +++++++---
 .../http/jetty/GridJettyRestHandler.java        | 27 ++++++++++++++++----
 3 files changed, 33 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cab277b8/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 7354214..55d60d2 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -39,7 +39,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * Tests for Jetty REST protocol.
  */
 @SuppressWarnings("unchecked")
-abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorSelfTest {
+public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorSelfTest {
     /** Grid count. */
     private static final int GRID_CNT = 3;
 
@@ -80,7 +80,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @return Returned content.
      * @throws Exception If failed.
      */
-    private String content(Map<String, String> params) throws Exception {
+    protected String content(Map<String, String> params) throws Exception {
         String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?";
 
         for (Map.Entry<String, String> e : params.entrySet())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cab277b8/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 079794e..4549db0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -539,6 +539,15 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
                 break;
 
+            case EXECUTE_SQL_QUERY:
+            case EXECUTE_SQL_FIELDS_QUERY:
+            case CLOSE_SQL_QUERY:
+            case FETCH_SQL_QUERY:
+                perm = SecurityPermission.CACHE_READ;
+                name = ((RestSqlQueryRequest)req).cacheName();
+
+                break;
+
             case CACHE_PUT:
             case CACHE_ADD:
             case CACHE_PUT_ALL:
@@ -585,10 +594,6 @@ public class GridRestProcessor extends GridProcessorAdapter {
             case LOG:
             case GET_OR_CREATE_CACHE:
             case DESTROY_CACHE:
-            case EXECUTE_SQL_QUERY:
-            case EXECUTE_SQL_FIELDS_QUERY:
-            case CLOSE_SQL_QUERY:
-            case FETCH_SQL_QUERY:
                 break;
 
             default:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cab277b8/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index d8bcac2..bf0f2c8 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -477,8 +477,13 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 restReq0.arguments(values("arg", params).toArray());
 
-                restReq0.typeName((String)params.get("type"));
-                restReq0.pageSize(Integer.parseInt((String) params.get("psz")));
+                restReq0.typeName((String) params.get("type"));
+
+                String psz = (String) params.get("psz");
+
+                if (psz != null)
+                    restReq0.pageSize(Integer.parseInt(psz));
+
                 restReq0.cacheName((String)params.get("cacheName"));
 
                 restReq = restReq0;
@@ -489,8 +494,16 @@ public class GridJettyRestHandler extends AbstractHandler {
             case FETCH_SQL_QUERY: {
                 RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
 
-                restReq0.queryId(Long.parseLong((String)params.get("qryId")));
-                restReq0.pageSize(Integer.parseInt((String)params.get("psz")));
+                String qryId = (String) params.get("qryId");
+
+                if (qryId != null)
+                    restReq0.queryId(Long.parseLong(qryId));
+
+                String psz = (String) params.get("psz");
+
+                if (psz != null)
+                    restReq0.pageSize(Integer.parseInt(psz));
+
                 restReq0.cacheName((String)params.get("cacheName"));
 
                 restReq = restReq0;
@@ -501,7 +514,11 @@ public class GridJettyRestHandler extends AbstractHandler {
             case CLOSE_SQL_QUERY: {
                 RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
 
-                restReq0.queryId(Long.parseLong((String)params.get("qryId")));
+                String qryId = (String) params.get("qryId");
+
+                if (qryId != null)
+                    restReq0.queryId(Long.parseLong(qryId));
+
                 restReq0.cacheName((String)params.get("cacheName"));
 
                 restReq = restReq0;