org.apache.hadoop.security
Class SaslRpcClient

java.lang.Object
  extended by org.apache.hadoop.security.SaslRpcClient

public class SaslRpcClient
extends Object

A utility class that encapsulates SASL logic for RPC client


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
SaslRpcClient(SaslRpcServer.AuthMethod method, Token<? extends TokenIdentifier> token, String serverPrincipal)
          Create a SaslRpcClient for an authentication method
 
Method Summary
 void dispose()
          Release resources used by wrapped saslClient
 InputStream getInputStream(InputStream in)
          Get a SASL wrapped InputStream.
 OutputStream getOutputStream(OutputStream out)
          Get a SASL wrapped OutputStream.
 boolean saslConnect(InputStream inS, OutputStream outS)
          Do client side SASL authentication with server via the given InputStream and OutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

SaslRpcClient

public SaslRpcClient(SaslRpcServer.AuthMethod method,
                     Token<? extends TokenIdentifier> token,
                     String serverPrincipal)
              throws IOException
Create a SaslRpcClient for an authentication method

Parameters:
method - the requested authentication method
token - token to use if needed by the authentication method
Throws:
IOException
Method Detail

saslConnect

public boolean saslConnect(InputStream inS,
                           OutputStream outS)
                    throws IOException
Do client side SASL authentication with server via the given InputStream and OutputStream

Parameters:
inS - InputStream to use
outS - OutputStream to use
Returns:
true if connection is set up, or false if needs to switch to simple Auth.
Throws:
IOException

getInputStream

public InputStream getInputStream(InputStream in)
                           throws IOException
Get a SASL wrapped InputStream. Can be called only after saslConnect() has been called.

Parameters:
in - the InputStream to wrap
Returns:
a SASL wrapped InputStream
Throws:
IOException

getOutputStream

public OutputStream getOutputStream(OutputStream out)
                             throws IOException
Get a SASL wrapped OutputStream. Can be called only after saslConnect() has been called.

Parameters:
out - the OutputStream to wrap
Returns:
a SASL wrapped OutputStream
Throws:
IOException

dispose

public void dispose()
             throws SaslException
Release resources used by wrapped saslClient

Throws:
SaslException


Copyright © 2009 The Apache Software Foundation