Package org.apache.giraph.comm.netty

Examples of org.apache.giraph.comm.netty.SaslNettyServer$SaslDigestCallbackHandler


    if (writableRequest.getType() == RequestType.SASL_TOKEN_MESSAGE_REQUEST) {
      // initialize server-side SASL functionality, if we haven't yet
      // (in which case we are looking at the first SASL message from the
      // client).
      SaslNettyServer saslNettyServer =
          NettyServer.CHANNEL_SASL_NETTY_SERVERS.get(ctx.getChannel());
      if (saslNettyServer == null) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("No saslNettyServer for " + ctx.getChannel() +
              " yet; creating now, with secret manager: " + secretManager);
        }
        saslNettyServer = new SaslNettyServer(secretManager);
        NettyServer.CHANNEL_SASL_NETTY_SERVERS.set(ctx.getChannel(),
            saslNettyServer);
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Found existing saslNettyServer on server:" +
              ctx.getChannel().getLocalAddress() + " for client " +
              ctx.getChannel().getRemoteAddress());
        }
      }

      ((SaslTokenMessageRequest) writableRequest).processToken(saslNettyServer);
      // Send response to client.
      ctx.getChannel().write(writableRequest);
      if (saslNettyServer.isComplete()) {
        // If authentication of client is complete, we will also send a
        // SASL-Complete message to the client.
        if (LOG.isDebugEnabled()) {
          LOG.debug("SASL authentication is complete for client with " +
              "username: " + saslNettyServer.getUserName());
        }
        SaslCompleteRequest saslComplete = new SaslCompleteRequest();
        ctx.getChannel().write(saslComplete);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Removing SaslServerHandler from pipeline since SASL " +
View Full Code Here


    if (LOG.isDebugEnabled()) {
      LOG.debug("messageReceived: Got " + e.getMessage().getClass());
    }
    // Authorize: client is allowed to doRequest() if and only if the client
    // has successfully authenticated with this server.
    SaslNettyServer saslNettyServer =
        NettyServer.CHANNEL_SASL_NETTY_SERVERS.get(ctx.getChannel());
    if (saslNettyServer == null) {
      LOG.warn("messageReceived: This client is *NOT* authorized to perform " +
          "this action since there's no saslNettyServer to " +
          "authenticate the client: " +
          "refusing to perform requested action: " + e.getMessage());
      return;
    }

    if (!saslNettyServer.isComplete()) {
      LOG.warn("messageReceived: This client is *NOT* authorized to perform " +
          "this action because SASL authentication did not complete: " +
          "refusing to perform requested action: " + e.getMessage());
      // Return now *WITHOUT* sending upstream here, since client
      // not authorized.
      return;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("messageReceived: authenticated client: " +
          saslNettyServer.getUserName() + " is authorized to do request " +
          "on server.");
    }
    // We call sendUpstream() since the client is allowed to perform this
    // request. The client's request will now proceed to the next
    // pipeline component, namely, RequestServerHandler.
View Full Code Here

    if (writableRequest.getType() == RequestType.SASL_TOKEN_MESSAGE_REQUEST) {
      // initialize server-side SASL functionality, if we haven't yet
      // (in which case we are looking at the first SASL message from the
      // client).
      SaslNettyServer saslNettyServer =
          ctx.attr(NettyServer.CHANNEL_SASL_NETTY_SERVERS).get();
      if (saslNettyServer == null) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("No saslNettyServer for " + ctx.channel() +
              " yet; creating now, with secret manager: " + secretManager);
        }
        try {
          saslNettyServer = new SaslNettyServer(secretManager,
            AuthMethod.SIMPLE);
        } catch (IOException ioe) { //TODO:
          throw new RuntimeException(ioe);
        }
        ctx.attr(NettyServer.CHANNEL_SASL_NETTY_SERVERS).set(saslNettyServer);
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Found existing saslNettyServer on server:" +
              ctx.channel().localAddress() + " for client " +
              ctx.channel().remoteAddress());
        }
      }

      ((SaslTokenMessageRequest) writableRequest).processToken(saslNettyServer);
      // Send response to client.
      ctx.write(writableRequest);
      if (saslNettyServer.isComplete()) {
        // If authentication of client is complete, we will also send a
        // SASL-Complete message to the client.
        if (LOG.isDebugEnabled()) {
          LOG.debug("SASL authentication is complete for client with " +
              "username: " + saslNettyServer.getUserName());
        }
        SaslCompleteRequest saslComplete = new SaslCompleteRequest();
        ctx.write(saslComplete);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Removing SaslServerHandler from pipeline since SASL " +
View Full Code Here

    if (LOG.isDebugEnabled()) {
      LOG.debug("messageReceived: Got " + msg.getClass());
    }
    // Authorize: client is allowed to doRequest() if and only if the client
    // has successfully authenticated with this server.
    SaslNettyServer saslNettyServer =
        ctx.attr(NettyServer.CHANNEL_SASL_NETTY_SERVERS).get();
    if (saslNettyServer == null) {
      LOG.warn("messageReceived: This client is *NOT* authorized to perform " +
          "this action since there's no saslNettyServer to " +
          "authenticate the client: " +
          "refusing to perform requested action: " + msg);
      return;
    }

    if (!saslNettyServer.isComplete()) {
      LOG.warn("messageReceived: This client is *NOT* authorized to perform " +
          "this action because SASL authentication did not complete: " +
          "refusing to perform requested action: " + msg);
      // Return now *WITHOUT* sending upstream here, since client
      // not authorized.
      return;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("messageReceived: authenticated client: " +
          saslNettyServer.getUserName() + " is authorized to do request " +
          "on server.");
    }
    // We call fireChannelRead since the client is allowed to perform this
    // request. The client's request will now proceed to the next
    // pipeline component, namely, RequestServerHandler.
View Full Code Here

TOP

Related Classes of org.apache.giraph.comm.netty.SaslNettyServer$SaslDigestCallbackHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.