Wildfire 3.1.1 Javadoc

org.jivesoftware.wildfire.net
Class SASLAuthentication

java.lang.Object
  extended by org.jivesoftware.wildfire.net.SASLAuthentication

public class SASLAuthentication
extends Object

SASLAuthentication is responsible for returning the available SASL mechanisms to use and for actually performing the SASL authentication.

The list of available SASL mechanisms is determined by 1) the type of UserProvider being used since some SASL mechanisms require the server to be able to retrieve user passwords; 2) whether anonymous logins are enabled or not and 3) whether the underlying connection has been secured or not.

Author:
Hao Chen, Gaston Dombiak

Nested Class Summary
static class SASLAuthentication.ElementType
           
static class SASLAuthentication.Status
           
 
Field Summary
protected static String CHARSET
          The utf-8 charset for decoding and encoding Jabber packet streams.
 
Constructor Summary
SASLAuthentication()
           
 
Method Summary
static void addSupportedMechanism(String mechanism)
          Adds a new SASL mechanism to the list of supported SASL mechanisms by the server.
static String getSASLMechanisms(Session session)
          Returns a string with the valid SASL mechanisms available for the specified session.
static Set<String> getSupportedMechanisms()
          Returns the list of supported SASL mechanisms by the server.
static SASLAuthentication.Status handle(Session session, org.dom4j.Element doc)
          Handles the SASL authentication packet.
static void removeSupportedMechanism(String mechanism)
          Removes a SASL mechanism from the list of supported SASL mechanisms by the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET

protected static String CHARSET
The utf-8 charset for decoding and encoding Jabber packet streams.

Constructor Detail

SASLAuthentication

public SASLAuthentication()
Method Detail

getSASLMechanisms

public static String getSASLMechanisms(Session session)
Returns a string with the valid SASL mechanisms available for the specified session. If the session's connection is not secured then only include the SASL mechanisms that don't require TLS.

Returns:
a string with the valid SASL mechanisms available for the specified session.

handle

public static SASLAuthentication.Status handle(Session session,
                                               org.dom4j.Element doc)
                                        throws UnsupportedEncodingException
Handles the SASL authentication packet. The entity may be sending an initial authentication request or a response to a challenge made by the server. The returned value indicates whether the authentication has finished either successfully or not or if the entity is expected to send a response to a challenge.

Parameters:
session - the session that is authenticating with the server.
doc - the stanza sent by the authenticating entity.
Returns:
value that indicates whether the authentication has finished either successfully or not or if the entity is expected to send a response to a challenge.
Throws:
UnsupportedEncodingException - If UTF-8 charset is not supported.

addSupportedMechanism

public static void addSupportedMechanism(String mechanism)
Adds a new SASL mechanism to the list of supported SASL mechanisms by the server. The new mechanism will be offered to clients and connection managers as stream features.

Parameters:
mechanism - the new SASL mechanism.

removeSupportedMechanism

public static void removeSupportedMechanism(String mechanism)
Removes a SASL mechanism from the list of supported SASL mechanisms by the server.

Parameters:
mechanism - the SASL mechanism to remove.

getSupportedMechanisms

public static Set<String> getSupportedMechanisms()
Returns the list of supported SASL mechanisms by the server. Note that Java may have support for more mechanisms but some of them may not be returned since a special setup is required that might be missing. Use addSupportedMechanism(String) to add new SASL mechanisms.

Returns:
the list of supported SASL mechanisms by the server.

Wildfire 3.1.1 Javadoc

Copyright © 2003-2006 Jive Software.