Package org.jivesoftware.openfire.sasl
Class JiveSharedSecretSaslServer
- java.lang.Object
-
- org.jivesoftware.openfire.sasl.JiveSharedSecretSaslServer
-
- All Implemented Interfaces:
SaslServer
public class JiveSharedSecretSaslServer extends Object implements SaslServer
Implementation of a proprietary Jive Software SASL mechanism that is based on a shared secret. Successful authentication will result in an anonymous authorization.- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
-
Constructor Summary
Constructors Constructor Description JiveSharedSecretSaslServer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
authenticateSharedSecret(String digest)
Returns true if the supplied digest matches the shared secret value.void
dispose()
byte[]
evaluateResponse(byte[] response)
String
getAuthorizationID()
String
getMechanismName()
Object
getNegotiatedProperty(String propName)
static String
getSharedSecret()
Returns the shared secret value, ornull
if shared secret authentication is disabled.boolean
isComplete()
static boolean
isSharedSecretAllowed()
Returns true if shared secret authentication is enabled.static void
setSharedSecretAllowed(boolean sharedSecretAllowed)
Sets whether shared secret authentication is enabled.byte[]
unwrap(byte[] incoming, int offset, int len)
byte[]
wrap(byte[] outgoing, int offset, int len)
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMechanismName
public String getMechanismName()
- Specified by:
getMechanismName
in interfaceSaslServer
-
evaluateResponse
public byte[] evaluateResponse(byte[] response) throws SaslException
- Specified by:
evaluateResponse
in interfaceSaslServer
- Throws:
SaslException
-
isComplete
public boolean isComplete()
- Specified by:
isComplete
in interfaceSaslServer
-
getAuthorizationID
public String getAuthorizationID()
- Specified by:
getAuthorizationID
in interfaceSaslServer
-
unwrap
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
- Specified by:
unwrap
in interfaceSaslServer
- Throws:
SaslException
-
wrap
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
- Specified by:
wrap
in interfaceSaslServer
- Throws:
SaslException
-
getNegotiatedProperty
public Object getNegotiatedProperty(String propName)
- Specified by:
getNegotiatedProperty
in interfaceSaslServer
-
dispose
public void dispose() throws SaslException
- Specified by:
dispose
in interfaceSaslServer
- Throws:
SaslException
-
authenticateSharedSecret
public static boolean authenticateSharedSecret(String digest)
Returns true if the supplied digest matches the shared secret value. The digest must be an MD5 hash of the secret key, encoded as hex. This value is supplied by clients attempting shared secret authentication.- Parameters:
digest
- the MD5 hash of the secret key, encoded as hex.- Returns:
- true if authentication succeeds.
-
isSharedSecretAllowed
public static boolean isSharedSecretAllowed()
Returns true if shared secret authentication is enabled. Shared secret authentication creates an anonymous session, but requires that the authenticating entity know a shared secret key. The client sends a digest of the secret key, which is compared against a digest of the local shared key.- Returns:
- true if shared secret authentication is enabled.
-
getSharedSecret
public static String getSharedSecret()
Returns the shared secret value, ornull
if shared secret authentication is disabled. If this is the first time the shared secret value has been requested (and shared secret auth is enabled), the key will be randomly generated and stored in the propertyxmpp.auth.sharedSecret
.- Returns:
- the shared secret value.
-
setSharedSecretAllowed
public static void setSharedSecretAllowed(boolean sharedSecretAllowed)
Sets whether shared secret authentication is enabled. Shared secret authentication creates an anonymous session, but requires that the authenticating entity know a shared secret key. The client sends a digest of the secret key, which is compared against a digest of the local shared key.- Parameters:
sharedSecretAllowed
- true if shared secret authentication should be enabled.
-
-