You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/08/25 17:11:18 UTC

incubator-tinkerpop git commit: Moved authentication attribute keys to StateKey.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master ae644951e -> 2d901153a


Moved authentication attribute keys to StateKey.

All other keys being used where in StateKey already.


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

Branch: refs/heads/master
Commit: 2d901153ab7e7674d4072c337a305ff4d2350b5b
Parents: ae64495
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Aug 25 11:10:16 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Aug 25 11:10:16 2015 -0400

----------------------------------------------------------------------
 .../handler/SaslAuthenticationHandler.java      |  8 ++-----
 .../gremlin/server/handler/StateKey.java        | 23 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2d901153/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
index 813cd6c..3cb88a8 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
@@ -22,7 +22,6 @@ import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.util.Attribute;
-import io.netty.util.AttributeKey;
 import org.apache.tinkerpop.gremlin.driver.Tokens;
 import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
@@ -46,9 +45,6 @@ import org.slf4j.LoggerFactory;
 public class SaslAuthenticationHandler extends ChannelInboundHandlerAdapter {
     private static final Logger logger = LoggerFactory.getLogger(SaslAuthenticationHandler.class);
 
-    private static final AttributeKey<Authenticator.SaslNegotiator> negotiatorKey = AttributeKey.valueOf("negotiator");
-    private static final AttributeKey<RequestMessage> requestKey = AttributeKey.valueOf("request");
-
     private final Authenticator authenticator;
 
     public SaslAuthenticationHandler(final Authenticator authenticator) {
@@ -60,8 +56,8 @@ public class SaslAuthenticationHandler extends ChannelInboundHandlerAdapter {
         if (msg instanceof RequestMessage){
             final RequestMessage requestMessage = (RequestMessage) msg;
 
-            final Attribute<Authenticator.SaslNegotiator> negotiator = ctx.attr(negotiatorKey);
-            final Attribute<RequestMessage> request = ctx.attr(requestKey);
+            final Attribute<Authenticator.SaslNegotiator> negotiator = ctx.attr(StateKey.NEGOTIATOR);
+            final Attribute<RequestMessage> request = ctx.attr(StateKey.REQUEST_MESSAGE);
             if (negotiator.get() == null) {
                 // First time through so save the request and send an AUTHENTICATE challenge with no data
                 negotiator.set(authenticator.newSaslNegotiator());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2d901153/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/StateKey.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/StateKey.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/StateKey.java
index dc4d392..de5048a 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/StateKey.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/StateKey.java
@@ -19,6 +19,8 @@
 package org.apache.tinkerpop.gremlin.server.handler;
 
 import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.apache.tinkerpop.gremlin.server.auth.Authenticator;
 import org.apache.tinkerpop.gremlin.server.op.session.Session;
 import io.netty.util.AttributeKey;
 
@@ -28,7 +30,28 @@ import io.netty.util.AttributeKey;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class StateKey {
+    /**
+     * The key for the current serializer requested by the client.
+     */
     public static final AttributeKey<MessageSerializer> SERIALIZER = AttributeKey.valueOf("serializer");
+
+    /**
+     * The key to indicate if the serializer should use its binary format.
+     */
     public static final AttributeKey<Boolean> USE_BINARY = AttributeKey.valueOf("useBinary");
+
+    /**
+     * The key for the current {@link Session} object.
+     */
     public static final AttributeKey<Session> SESSION = AttributeKey.valueOf("session");
+
+    /**
+     * The key for the current SASL negotiator.
+     */
+    public static final AttributeKey<Authenticator.SaslNegotiator> NEGOTIATOR = AttributeKey.valueOf("negotiator");
+
+    /**
+     * The key for the current request.
+     */
+    public static final AttributeKey<RequestMessage> REQUEST_MESSAGE = AttributeKey.valueOf("request");
 }