public abstract class SASLMechanism
extends java.lang.Object
implements javax.security.auth.callback.CallbackHandler
getName()
-- returns the common name of the SASL mechanism.authenticate(String, String, String)
-- Initiate authentication stanza using the
deprecated method.authenticate(String, String, CallbackHandler)
-- Initiate authentication stanza
using the CallbackHandler method.challengeReceived(String)
-- Handle a challenge from the server.Modifier and Type | Class and Description |
---|---|
class |
SASLMechanism.AuthMechanism
Initiating SASL authentication by select a mechanism.
|
static class |
SASLMechanism.Challenge
A SASL challenge stanza.
|
static class |
SASLMechanism.Failure
A SASL failure stanza.
|
class |
SASLMechanism.Response
A SASL response stanza.
|
static class |
SASLMechanism.Success
A SASL success stanza.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
authenticationId |
protected java.lang.String |
hostname |
protected java.lang.String |
password |
protected javax.security.sasl.SaslClient |
sc |
Constructor and Description |
---|
SASLMechanism(SASLAuthentication saslAuthentication) |
Modifier and Type | Method and Description |
---|---|
protected void |
authenticate() |
void |
authenticate(java.lang.String username,
java.lang.String host,
javax.security.auth.callback.CallbackHandler cbh)
Builds and sends the auth stanza to the server.
|
void |
authenticate(java.lang.String username,
java.lang.String host,
java.lang.String password)
Builds and sends the auth stanza to the server.
|
void |
challengeReceived(java.lang.String challenge)
The server is challenging the SASL mechanism for the stanza he just sent.
|
protected abstract java.lang.String |
getName()
Returns the common name of the SASL mechanism.
|
protected SASLAuthentication |
getSASLAuthentication() |
void |
handle(javax.security.auth.callback.Callback[] callbacks) |
protected javax.security.sasl.SaslClient sc
protected java.lang.String authenticationId
protected java.lang.String password
protected java.lang.String hostname
public SASLMechanism(SASLAuthentication saslAuthentication)
public void authenticate(java.lang.String username, java.lang.String host, java.lang.String password) throws java.io.IOException, XMPPException
authenticate(String, String, CallbackHandler)
whenever possible.username
- the username of the user being authenticated.host
- the hostname where the user account resides.password
- the password for this account.java.io.IOException
- If a network error occurs while authenticating.XMPPException
- If a protocol error occurs or the user is not authenticated.public void authenticate(java.lang.String username, java.lang.String host, javax.security.auth.callback.CallbackHandler cbh) throws java.io.IOException, XMPPException
username
- the username of the user being authenticated.host
- the hostname where the user account resides.cbh
- the CallbackHandler to obtain user information.java.io.IOException
- If a network error occures while authenticating.XMPPException
- If a protocol error occurs or the user is not authenticated.protected void authenticate() throws java.io.IOException, XMPPException
java.io.IOException
XMPPException
public void challengeReceived(java.lang.String challenge) throws java.io.IOException
challenge
- a base64 encoded string representing the challenge.java.io.IOException
- if an exception sending the response occurs.protected abstract java.lang.String getName()
protected SASLAuthentication getSASLAuthentication()
public void handle(javax.security.auth.callback.Callback[] callbacks) throws java.io.IOException, javax.security.auth.callback.UnsupportedCallbackException
handle
in interface javax.security.auth.callback.CallbackHandler
java.io.IOException
javax.security.auth.callback.UnsupportedCallbackException
Copyright © 2003-2007 Jive Software.