Package com.isode.som
Class SomScramSha1Client
- java.lang.Object
-
- com.isode.som.SomScramSha1Client
-
- All Implemented Interfaces:
javax.security.sasl.SaslClient
public class SomScramSha1Client extends java.lang.Object implements javax.security.sasl.SaslClient
Class which implements a SCRAM-SHA-1 SASL client, in line with the requirements of javax.security.sasl. The code uses the SCRAMSHA1ClientAuthenticator class from the Stroke package to handle the challenge/response generation etc. Note that the wrap and unwrap methods of this class have not been implemented yet: they are not required for the SOM API's use of SASL. The NameCallback and PasswordCallback are used to obtain the authentication id and password respectively.- Since:
- 16.1
- Author:
- tc
-
-
Constructor Summary
Constructors Constructor Description SomScramSha1Client(java.lang.String authzid, java.lang.String protocol, java.lang.String server, javax.security.auth.callback.CallbackHandler cbh)
Create a new instance of a SaslClient which supports SCRAM-SHA-1
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Delete objectbyte[]
evaluateChallenge(byte[] arg0)
Evaluate a challengejava.lang.String
getMechanismName()
Return the name of this client's mechanismjava.lang.Object
getNegotiatedProperty(java.lang.String arg0)
Get a negotiated propertyboolean
hasInitialResponse()
Whether this mechanism provides an initial responseboolean
isComplete()
Whether authentication is complete or notbyte[]
unwrap(byte[] arg0, int arg1, int arg2)
Unwrap data - not yet implementedbyte[]
wrap(byte[] arg0, int arg1, int arg2)
Wrap data - not yet implemented
-
-
-
Constructor Detail
-
SomScramSha1Client
public SomScramSha1Client(java.lang.String authzid, java.lang.String protocol, java.lang.String server, javax.security.auth.callback.CallbackHandler cbh) throws javax.security.sasl.SaslException
Create a new instance of a SaslClient which supports SCRAM-SHA-1- Parameters:
authzid
- authorization idprotocol
- not usedserver
- not usedcbh
- callback handler- Throws:
javax.security.sasl.SaslException
- on error
-
-
Method Detail
-
dispose
public void dispose() throws javax.security.sasl.SaslException
Delete object- Specified by:
dispose
in interfacejavax.security.sasl.SaslClient
- Throws:
javax.security.sasl.SaslException
- for compatibility
-
evaluateChallenge
public byte[] evaluateChallenge(byte[] arg0) throws javax.security.sasl.SaslException
Evaluate a challenge- Specified by:
evaluateChallenge
in interfacejavax.security.sasl.SaslClient
- Parameters:
arg0
- the challenge string- Throws:
javax.security.sasl.SaslException
-
getMechanismName
public java.lang.String getMechanismName()
Return the name of this client's mechanism- Specified by:
getMechanismName
in interfacejavax.security.sasl.SaslClient
- Returns:
- mechanism name
-
getNegotiatedProperty
public java.lang.Object getNegotiatedProperty(java.lang.String arg0)
Get a negotiated property- Specified by:
getNegotiatedProperty
in interfacejavax.security.sasl.SaslClient
- Parameters:
arg0
- the property to get- Returns:
- property value
-
hasInitialResponse
public boolean hasInitialResponse()
Whether this mechanism provides an initial response- Specified by:
hasInitialResponse
in interfacejavax.security.sasl.SaslClient
- Returns:
- boolean value
-
isComplete
public boolean isComplete()
Whether authentication is complete or not- Specified by:
isComplete
in interfacejavax.security.sasl.SaslClient
- Returns:
- boolean value
-
unwrap
public byte[] unwrap(byte[] arg0, int arg1, int arg2) throws javax.security.sasl.SaslException
Unwrap data - not yet implemented- Specified by:
unwrap
in interfacejavax.security.sasl.SaslClient
- Parameters:
arg0
- notusedarg1
- notusedarg2
- notused- Returns:
- the unwrapped data
- Throws:
javax.security.sasl.SaslException
- on error
-
wrap
public byte[] wrap(byte[] arg0, int arg1, int arg2) throws javax.security.sasl.SaslException
Wrap data - not yet implemented- Specified by:
wrap
in interfacejavax.security.sasl.SaslClient
- Parameters:
arg0
- notusedarg1
- notusedarg2
- notused- Returns:
- the unwrapped data
- Throws:
javax.security.sasl.SaslException
- on error
-
-