org.apache.hadoop.hbase.security
Class HBaseSaslRpcClient

java.lang.Object
  extended by org.apache.hadoop.hbase.security.HBaseSaslRpcClient

@InterfaceAudience.Private
public class HBaseSaslRpcClient
extends Object

A utility class that encapsulates SASL logic for RPC client. Copied from org.apache.hadoop.security


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
HBaseSaslRpcClient(AuthMethod method, org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token, String serverPrincipal, boolean fallbackAllowed)
          Create a HBaseSaslRpcClient for an authentication method
HBaseSaslRpcClient(AuthMethod method, org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token, String serverPrincipal, boolean fallbackAllowed, String rpcProtection)
          Create a HBaseSaslRpcClient for an authentication method
 
Method Summary
protected  SaslClient createDigestSaslClient(String[] mechanismNames, String saslDefaultRealm, CallbackHandler saslClientCallbackHandler)
           
protected  SaslClient createKerberosSaslClient(String[] mechanismNames, String userFirstPart, String userSecondPart)
           
 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

HBaseSaslRpcClient

public HBaseSaslRpcClient(AuthMethod method,
                          org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token,
                          String serverPrincipal,
                          boolean fallbackAllowed)
                   throws IOException
Create a HBaseSaslRpcClient for an authentication method

Parameters:
method - the requested authentication method
token - token to use if needed by the authentication method
serverPrincipal - the server principal that we are trying to set the connection up to
fallbackAllowed - does the client allow fallback to simple authentication
Throws:
IOException

HBaseSaslRpcClient

public HBaseSaslRpcClient(AuthMethod method,
                          org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token,
                          String serverPrincipal,
                          boolean fallbackAllowed,
                          String rpcProtection)
                   throws IOException
Create a HBaseSaslRpcClient for an authentication method

Parameters:
method - the requested authentication method
token - token to use if needed by the authentication method
serverPrincipal - the server principal that we are trying to set the connection up to
fallbackAllowed - does the client allow fallback to simple authentication
rpcProtection - the protection level ("authentication", "integrity" or "privacy")
Throws:
IOException
Method Detail

createDigestSaslClient

protected SaslClient createDigestSaslClient(String[] mechanismNames,
                                            String saslDefaultRealm,
                                            CallbackHandler saslClientCallbackHandler)
                                     throws IOException
Throws:
IOException

createKerberosSaslClient

protected SaslClient createKerberosSaslClient(String[] mechanismNames,
                                              String userFirstPart,
                                              String userSecondPart)
                                       throws IOException
Throws:
IOException

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 © 2007-2016 The Apache Software Foundation. All Rights Reserved.