public abstract class AbstractSaslCallbackHandler
extends java.lang.Object
implements javax.security.auth.callback.CallbackHandler
CallbackHandlers. Implementations of SASL mechanisms
selectively override the methods relevant to their mechanism.CallbackHandler| Modifier and Type | Field and Description |
|---|---|
protected CoreSession |
adminSession
The admin core session
|
protected org.apache.directory.api.ldap.model.message.BindRequest |
bindRequest
The associated BindRequest
|
protected DirectoryService |
directoryService
A reference on the DirectoryService instance
|
private static org.apache.directory.api.ldap.model.message.Control[] |
EMPTY
An empty control array
|
protected LdapSession |
ldapSession
The reference on the user ldap session
|
private static org.slf4j.Logger |
LOG
The logger instance
|
private java.lang.String |
realm |
private java.lang.String |
username |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSaslCallbackHandler(DirectoryService directoryService,
org.apache.directory.api.ldap.model.message.BindRequest bindRequest)
Creates a new instance of AbstractSaslCallbackHandler.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
authorize(javax.security.sasl.AuthorizeCallback callback)
Final check to authorize user.
|
protected javax.naming.ldap.LdapContext |
getContext(org.apache.mina.core.session.IoSession session,
org.apache.directory.api.ldap.model.message.BindRequest bindRequest,
java.util.Hashtable<java.lang.String,java.lang.Object> env)
Convenience method for acquiring an
LdapContext for the client to use for the
duration of a session. |
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
getEnvironment(org.apache.mina.core.session.IoSession session)
Convenience method for getting an environment suitable for acquiring
an
LdapContext for the client. |
protected java.lang.String |
getRealm()
Implementors use this method to access the realm resulting from a callback.
|
protected java.lang.String |
getUsername()
Implementors use this method to access the username resulting from a callback.
|
void |
handle(javax.security.auth.callback.Callback[] callbacks)
SaslServer will use this method to call various callbacks, depending on the SASL
mechanism in use for a session.
|
protected abstract org.apache.directory.api.ldap.model.entry.Attribute |
lookupPassword(java.lang.String username,
java.lang.String realm)
Implementors set the password based on a lookup, using the username and
realm as keys.
|
private static final org.slf4j.Logger LOG
private static final org.apache.directory.api.ldap.model.message.Control[] EMPTY
private java.lang.String username
private java.lang.String realm
protected LdapSession ldapSession
protected CoreSession adminSession
protected final DirectoryService directoryService
protected final org.apache.directory.api.ldap.model.message.BindRequest bindRequest
protected AbstractSaslCallbackHandler(DirectoryService directoryService, org.apache.directory.api.ldap.model.message.BindRequest bindRequest)
directoryService - protected java.lang.String getUsername()
NameCallback is not used by GSSAPI.protected java.lang.String getRealm()
RealmCallback is not used by GSSAPI nor by CRAM-MD5.protected abstract org.apache.directory.api.ldap.model.entry.Attribute lookupPassword(java.lang.String username,
java.lang.String realm)
username - The username.realm - The realm.protected abstract void authorize(javax.security.sasl.AuthorizeCallback callback)
throws java.lang.Exception
true if authentication was successful.callback - An AuthorizeCallback.java.lang.Exceptionpublic void handle(javax.security.auth.callback.Callback[] callbacks)
handle in interface javax.security.auth.callback.CallbackHandlercallbacks - An array of one or more callbacks.protected javax.naming.ldap.LdapContext getContext(org.apache.mina.core.session.IoSession session,
org.apache.directory.api.ldap.model.message.BindRequest bindRequest,
java.util.Hashtable<java.lang.String,java.lang.Object> env)
LdapContext for the client to use for the
duration of a session.session - The current session.bindRequest - The current BindRequest.env - An environment to be used to acquire an LdapContext.LdapContext for the client.protected java.util.Hashtable<java.lang.String,java.lang.Object> getEnvironment(org.apache.mina.core.session.IoSession session)
LdapContext for the client.session - The current session.LdapContext for the client.