Smack

org.jivesoftware.smack.sasl
Class SASLGSSAPIMechanism

java.lang.Object
  extended by org.jivesoftware.smack.sasl.SASLMechanism
      extended by org.jivesoftware.smack.sasl.SASLGSSAPIMechanism

public class SASLGSSAPIMechanism
extends SASLMechanism

Implementation of the SASL GSSAPI mechanisn

Author:
Jay Kline

Constructor Summary
SASLGSSAPIMechanism(SASLAuthentication saslAuthentication)
           
 
Method Summary
 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.
protected  String getAuthenticationText(String username, String host, String password)
          Returns the authentication text to include in the initial auth stanza or null if nothing should be added.
protected  String getChallengeResponse(byte[] bytes)
          Returns the response text to send answering the challenge sent by the server.
protected  String getName()
          Returns the common name of the SASL mechanism.
 
Methods inherited from class org.jivesoftware.smack.sasl.SASLMechanism
getSASLAuthentication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SASLGSSAPIMechanism

public SASLGSSAPIMechanism(SASLAuthentication saslAuthentication)
Method Detail

getName

protected String getName()
Description copied from class: SASLMechanism
Returns the common name of the SASL mechanism. E.g.: PLAIN, DIGEST-MD5 or KERBEROS_V4.

Specified by:
getName in class SASLMechanism
Returns:
the common name of the SASL mechanism.

authenticate

public void authenticate(String username,
                         String host,
                         String password)
                  throws IOException
Builds and sends the auth stanza to the server. This overrides from the abstract class because the initial token needed for GSSAPI is binary, and not safe to put in a string, thus getAuthenticationText() cannot be used.

Overrides:
authenticate in class SASLMechanism
Parameters:
username - the username of the user being authenticated.
host - the hostname where the user account resides.
password - the password of the user (ignored for GSSAPI)
Throws:
IOException - If a network error occures while authenticating.

getAuthenticationText

protected String getAuthenticationText(String username,
                                       String host,
                                       String password)
Description copied from class: SASLMechanism
Returns the authentication text to include in the initial auth stanza or null if nothing should be added.

Specified by:
getAuthenticationText in class SASLMechanism
Parameters:
username - the username of the user being authenticated.
host - the hostname where the user account resides.
password - the password of the user.
Returns:
the authentication text to include in the initial auth stanza or null if nothing should be added.

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. This overrieds from the abstract class because the tokens needed for GSSAPI are binary, and not safe to put in a string, thus getChallengeResponse() cannot be used.

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

getChallengeResponse

protected String getChallengeResponse(byte[] bytes)
Description copied from class: SASLMechanism
Returns the response text to send answering the challenge sent by the server. Mechanisms that will never receive a challenge may redefine this method returning null.

Specified by:
getChallengeResponse in class SASLMechanism
Parameters:
bytes - the challenge sent by the server.
Returns:
the response text to send to answer the challenge sent by the server.

Smack

Copyright © 2003-2007 Jive Software.