Package com.isode.som

Class 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 object
      byte[] evaluateChallenge​(byte[] arg0)
      Evaluate a challenge
      java.lang.String getMechanismName()
      Return the name of this client's mechanism
      java.lang.Object getNegotiatedProperty​(java.lang.String arg0)
      Get a negotiated property
      boolean hasInitialResponse()
      Whether this mechanism provides an initial response
      boolean isComplete()
      Whether authentication is complete or not
      byte[] unwrap​(byte[] arg0, int arg1, int arg2)
      Unwrap data - not yet implemented
      byte[] wrap​(byte[] arg0, int arg1, int arg2)
      Wrap data - not yet implemented
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 id
        protocol - not used
        server - not used
        cbh - 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 interface javax.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 interface javax.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 interface javax.security.sasl.SaslClient
        Returns:
        mechanism name
      • getNegotiatedProperty

        public java.lang.Object getNegotiatedProperty​(java.lang.String arg0)
        Get a negotiated property
        Specified by:
        getNegotiatedProperty in interface javax.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 interface javax.security.sasl.SaslClient
        Returns:
        boolean value
      • isComplete

        public boolean isComplete()
        Whether authentication is complete or not
        Specified by:
        isComplete in interface javax.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 interface javax.security.sasl.SaslClient
        Parameters:
        arg0 - notused
        arg1 - notused
        arg2 - 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 interface javax.security.sasl.SaslClient
        Parameters:
        arg0 - notused
        arg1 - notused
        arg2 - notused
        Returns:
        the unwrapped data
        Throws:
        javax.security.sasl.SaslException - on error