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 booleanauthenticateSharedSecret(String digest)Returns true if the supplied digest matches the shared secret value.voiddispose()byte[]evaluateResponse(byte[] response)StringgetAuthorizationID()StringgetMechanismName()ObjectgetNegotiatedProperty(String propName)static StringgetSharedSecret()Returns the shared secret value, ornullif shared secret authentication is disabled.booleanisComplete()static booleanisSharedSecretAllowed()Returns true if shared secret authentication is enabled.static voidsetSharedSecretAllowed(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:
getMechanismNamein interfaceSaslServer
-
evaluateResponse
public byte[] evaluateResponse(byte[] response) throws SaslException- Specified by:
evaluateResponsein interfaceSaslServer- Throws:
SaslException
-
isComplete
public boolean isComplete()
- Specified by:
isCompletein interfaceSaslServer
-
getAuthorizationID
public String getAuthorizationID()
- Specified by:
getAuthorizationIDin interfaceSaslServer
-
unwrap
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException- Specified by:
unwrapin interfaceSaslServer- Throws:
SaslException
-
wrap
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException- Specified by:
wrapin interfaceSaslServer- Throws:
SaslException
-
getNegotiatedProperty
public Object getNegotiatedProperty(String propName)
- Specified by:
getNegotiatedPropertyin interfaceSaslServer
-
dispose
public void dispose() throws SaslException- Specified by:
disposein 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, ornullif 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.
-
-