ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [19/50] [abbrv] incubator-ignite git commit: #ignite-gg-9809: Mock session tokens.
Date Tue, 24 Feb 2015 09:09:57 GMT
#ignite-gg-9809: Mock session tokens.


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

Branch: refs/heads/ignite-283-tx
Commit: 763818e94e6cee028628cee1d88967491d224d3e
Parents: 2a73b06
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Feb 19 15:36:33 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Feb 19 15:36:33 2015 +0300

----------------------------------------------------------------------
 .../processors/rest/GridRestProcessor.java      | 51 +++-----------------
 1 file changed, 6 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/763818e9/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 8cf26cc..3d0f073 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
@@ -71,7 +71,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
     private final LongAdder workersCnt = new LongAdder();
 
     /** SecurityContext map. */
-    private ConcurrentMap<SubjectKey, SecurityContext> sesMap = new ConcurrentHashMap8<>();
+    private ConcurrentMap<UUID, SecurityContext> sesMap = new ConcurrentHashMap<>();
 
     /** Protocol handler. */
     private final GridRestProtocolHandler protoHnd = new GridRestProtocolHandler() {
@@ -461,7 +461,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
      */
     private SecurityContext authenticate(GridRestRequest req) throws IgniteCheckedException
{
         UUID clientId = req.clientId();
-        SecurityContext secCtx = sesMap.get(new SubjectKey(REMOTE_CLIENT, clientId));
+        SecurityContext secCtx = sesMap.get(clientId);
 
         if (secCtx != null)
             return secCtx;
@@ -513,7 +513,10 @@ public class GridRestProcessor extends GridProcessorAdapter {
      * @param sCtx Security context.
      */
     private void updateSession(GridRestRequest req, SecurityContext sCtx) throws IgniteCheckedException
{
-        sesMap.put(new SubjectKey(REMOTE_CLIENT, req.clientId()), sCtx);
+        if (sCtx != null) {
+            UUID id = req.clientId();
+            sesMap.put(id, sCtx);
+        }
     }
 
     /**
@@ -675,46 +678,4 @@ public class GridRestProcessor extends GridProcessorAdapter {
         X.println(">>>   protosSize: " + protos.size());
         X.println(">>>   handlersSize: " + handlers.size());
     }
-
-    /**
-     * Subject key.
-     */
-    private static class SubjectKey {
-        /** */
-        private final GridSecuritySubjectType subjType;
-
-        /** */
-        private final UUID subjId;
-
-        /**
-         * @param subjType Subject type.
-         * @param subjId Subject ID.
-         */
-        private SubjectKey(GridSecuritySubjectType subjType, UUID subjId) {
-            this.subjType = subjType;
-            this.subjId = subjId;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (!(o instanceof SubjectKey))
-                return false;
-
-            SubjectKey that = (SubjectKey)o;
-
-            return F.eq(subjId, that.subjId) && subjType == that.subjType;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            int res = subjType.hashCode();
-
-            res = 31 * res + (subjId == null ? 0 : subjId.hashCode());
-
-            return res;
-        }
-    }
 }


Mime
View raw message