Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.sasl
Class SASLDigestMD5Mechanism

java.lang.Object
  extended by org.jivesoftware.smack.sasl.SASLMechanism
      extended by org.jivesoftware.smack.sasl.SASLDigestMD5Mechanism
          extended by net.java.sip.communicator.impl.protocol.jabber.sasl.SASLDigestMD5Mechanism
All Implemented Interfaces:
CallbackHandler

public class SASLDigestMD5Mechanism
extends org.jivesoftware.smack.sasl.SASLDigestMD5Mechanism

Creates our custom SASLDigestMD5Mechanism with some changes in order to be compatible with some jabber servers.

Author:
Damian Minkov

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jivesoftware.smack.sasl.SASLMechanism
org.jivesoftware.smack.sasl.SASLMechanism.AuthMechanism, org.jivesoftware.smack.sasl.SASLMechanism.Challenge, org.jivesoftware.smack.sasl.SASLMechanism.Failure, org.jivesoftware.smack.sasl.SASLMechanism.Response, org.jivesoftware.smack.sasl.SASLMechanism.Success
 
Field Summary
 
Fields inherited from class org.jivesoftware.smack.sasl.SASLMechanism
authenticationId, hostname, password, sc
 
Constructor Summary
SASLDigestMD5Mechanism(org.jivesoftware.smack.SASLAuthentication saslAuthentication)
          Creates our mechanism.
 
Method Summary
 void authenticate(String username, String host, CallbackHandler cbh)
          Builds and sends the auth stanza to the server.
 void authenticate(String username, String host, String password)
          Builds and sends the auth stanza to the server.
 void challengeReceived(String challenge)
          The server is challenging the SASL mechanism for the stanza he just sent.
 
Methods inherited from class org.jivesoftware.smack.sasl.SASLDigestMD5Mechanism
getName
 
Methods inherited from class org.jivesoftware.smack.sasl.SASLMechanism
authenticate, getSASLAuthentication, handle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SASLDigestMD5Mechanism

public SASLDigestMD5Mechanism(org.jivesoftware.smack.SASLAuthentication saslAuthentication)
Creates our mechanism.

Parameters:
saslAuthentication -
Method Detail

authenticate

public void authenticate(String username,
                         String host,
                         String password)
                  throws IOException,
                         org.jivesoftware.smack.XMPPException
Builds and sends the auth stanza to the server. Note that this method of authentication is not recommended, since it is very inflexible. Use authenticate(String, String, CallbackHandler) whenever possible.

Overrides:
authenticate in class org.jivesoftware.smack.sasl.SASLMechanism
Parameters:
username - the username of the user being authenticated.
host - the hostname where the user account resides.
password - the password for this account.
Throws:
IOException - If a network error occurs while authenticating.
org.jivesoftware.smack.XMPPException - If a protocol error occurs or the user is not authenticated.

authenticate

public void authenticate(String username,
                         String host,
                         CallbackHandler cbh)
                  throws IOException,
                         org.jivesoftware.smack.XMPPException
Builds and sends the auth stanza to the server. The callback handler will handle any additional information, such as the authentication ID or realm, if it is needed.

Overrides:
authenticate in class org.jivesoftware.smack.sasl.SASLMechanism
Parameters:
username - the username of the user being authenticated.
host - the hostname where the user account resides.
cbh - the CallbackHandler to obtain user information.
Throws:
IOException - If a network error occurs while authenticating.
org.jivesoftware.smack.XMPPException - If a protocol error occurs or the user is not authenticated.

challengeReceived

public void challengeReceived(String challenge)
                       throws IOException
The server is challenging the SASL mechanism for the stanza he just sent. Send a response to the server's challenge.

Overrides:
challengeReceived in class org.jivesoftware.smack.sasl.SASLMechanism
Parameters:
challenge - a base64 encoded string representing the challenge.
Throws:
IOException - if an exception sending the response occurs.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.