Package org.apache.bookkeeper.sasl
Class SASLClientProviderFactory
- java.lang.Object
-
- org.apache.bookkeeper.sasl.SASLClientProviderFactory
-
- All Implemented Interfaces:
ClientAuthProvider.Factory
,JAASCredentialsContainer
public class SASLClientProviderFactory extends java.lang.Object implements ClientAuthProvider.Factory, JAASCredentialsContainer
ClientAuthProvider which uses JDK-bundled SASL.
-
-
Constructor Summary
Constructors Constructor Description SASLClientProviderFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Release resources.AbstractConfiguration
getConfiguration()
javax.security.auth.login.LoginContext
getLogin()
java.lang.String
getLoginContextName()
java.lang.String
getPluginName()
Get Auth provider plugin name.java.lang.String
getPrincipal()
javax.security.auth.Subject
getSubject()
void
init(ClientConfiguration conf)
Initialize the factory with the client configuration and protobuf message registry.boolean
isUsingTicketCache()
ClientAuthProvider
newProvider(ClientConnectionPeer addr, AuthCallbacks.GenericCallback<java.lang.Void> completeCb)
Create a new instance of a client auth provider.void
setLogin(javax.security.auth.login.LoginContext login)
-
-
-
Method Detail
-
init
public void init(ClientConfiguration conf) throws java.io.IOException
Description copied from interface:ClientAuthProvider.Factory
Initialize the factory with the client configuration and protobuf message registry. Implementors must add any extension messages which contain the auth payload, so that the client can decode auth messages it receives from the server.- Specified by:
init
in interfaceClientAuthProvider.Factory
- Throws:
java.io.IOException
-
newProvider
public ClientAuthProvider newProvider(ClientConnectionPeer addr, AuthCallbacks.GenericCallback<java.lang.Void> completeCb)
Description copied from interface:ClientAuthProvider.Factory
Create a new instance of a client auth provider. Each connection should get its own instance, as they can hold connection specific state. The completeCb is used to notify the client that the authentication handshake is complete. CompleteCb should be called only once. If the authentication was successful, BKException.Code.OK should be passed as the return code. Otherwise, another error code should be passed.- Specified by:
newProvider
in interfaceClientAuthProvider.Factory
- Parameters:
addr
- an handle to the connectioncompleteCb
- callback to be notified when authentication is complete.
-
getPluginName
public java.lang.String getPluginName()
Description copied from interface:ClientAuthProvider.Factory
Get Auth provider plugin name. Used as a sanity check to ensure that the bookie and the client. are using the same auth provider.- Specified by:
getPluginName
in interfaceClientAuthProvider.Factory
-
close
public void close()
Description copied from interface:ClientAuthProvider.Factory
Release resources.- Specified by:
close
in interfaceClientAuthProvider.Factory
-
getLogin
public javax.security.auth.login.LoginContext getLogin()
- Specified by:
getLogin
in interfaceJAASCredentialsContainer
-
setLogin
public void setLogin(javax.security.auth.login.LoginContext login)
- Specified by:
setLogin
in interfaceJAASCredentialsContainer
-
getSubject
public javax.security.auth.Subject getSubject()
- Specified by:
getSubject
in interfaceJAASCredentialsContainer
-
isUsingTicketCache
public boolean isUsingTicketCache()
- Specified by:
isUsingTicketCache
in interfaceJAASCredentialsContainer
-
getPrincipal
public java.lang.String getPrincipal()
- Specified by:
getPrincipal
in interfaceJAASCredentialsContainer
-
getConfiguration
public AbstractConfiguration getConfiguration()
- Specified by:
getConfiguration
in interfaceJAASCredentialsContainer
-
getLoginContextName
public java.lang.String getLoginContextName()
- Specified by:
getLoginContextName
in interfaceJAASCredentialsContainer
-
-