Class AuthenticationHandler


  • public abstract class AuthenticationHandler
    extends java.net.Authenticator
    An abstract class from which to derive protocol authenticators.
    • Constructor Detail

      • AuthenticationHandler

        public AuthenticationHandler​(AuthenticationHandler.HandlerType eType)
        Constructor
        Parameters:
        eType - The handler type; CLIENT or SERVER
    • Method Detail

      • checkAuthenticationStatus

        public abstract boolean checkAuthenticationStatus()
        Called by Protocol to return the status of the authentication call. NOTE: You MUST return false in order to stop the authentication loop. If true is returned, Protocol assumes you want to loop again (ask the handler for credentials and try the http request again).
        Returns:
        True to indicate that we should try to connect with the credentials, or False to cancel
      • checkSOAPAuthenticationStatus

        public abstract boolean checkSOAPAuthenticationStatus()
        Called by xfawsdlconnectionsetproxy to return the status of the authentication call, and if successful
        Returns:
        True to indicate that we should try to connect with the credentials, or False to cancel
      • clone

        public abstract AuthenticationHandler clone()
        Clone this AuthenticationHandler object.
        Returns:
        a copy of this object.
      • getBasicCredentials

        public abstract boolean getBasicCredentials​(java.lang.String sURL,
                                                    java.lang.String sRealm,
                                                    StringHolder sUserID,
                                                    CharacterHolder aPassword)
        Called by Protocol to return the user id and password for the URL
        Parameters:
        sURL - passed in by the caller(Protocol) - the url we are connecting to
        sRealm - passed in by the caller(Protocol) - the realm information from the protocol layer
        sUserID - to be filled by the method - the user id to use for the connection
        aPassword - to be filled by the method - the password to use for the connection
        Returns:
        True to indicate that we should try to connect with the credentials, or False to cancel
      • getBasicSOAPCredentials

        public abstract boolean getBasicSOAPCredentials​(java.lang.String sSOAPAddress,
                                                        java.lang.String sConnectionName,
                                                        java.lang.String sOperationName,
                                                        StringHolder sUserID,
                                                        CharacterHolder aPassword)
        Called by xfawsdlconnectionsetproxy to return the user id and password for the SOAP header
        Parameters:
        sSOAPAddress - passed in by the caller - the SOAP address we are connecting to
        sConnectionName - passed in by the caller - the wsdlConnection name
        sOperationName - passed in by the caller - the name of the operation being called
        sUserID - to be filled by the method - the user id to use for the connection
        aPassword - to be filled by the method - the password to use for the connection
        Returns:
        True to indicate that we should try to connect with the credentials, or False to cancel
      • getCertificateCredentials

        public abstract boolean getCertificateCredentials​(java.lang.String sUrl,
                                                          CharacterHolder aCertPassword,
                                                          IntegerHolder nCertSize,
                                                          ObjectHolder<byte[]> oCertBuffer,
                                                          StringHolder sHint)
        Called Protocol to return the certificate for the URL
        Parameters:
        sUrl - passed in by the caller(Protocol), the url we are connecting to
        aCertPassword - the password to encode the certificate with. This parameter will only be populated if the pCertBuffer contains PKCS#12 data.
        nCertSize - the size of the certificate buffer. This is only populate if the pCertBuffer contains PKCS#12 data.
        oCertBuffer - depending on the application, this parameter may be populated with a buffer containing encrypted (using the aCertPassword specified parameter 2 above) PKCS#12 data, or PCCERT_CONTEXT (Windows specific) data, as some Windows applications may only have access to the Windows PCCERT_CONTEXT and not to a PKCS#12 stream. It this parameter is populated with a PCCERT_CONTEXT then the nCertSize parameter will be set to zero and the aCertPassword will be empty.
        sHint - this parameter is populated by the caller and used as a hint so that the calling application knows certificate they are working with when callback's are made.
        Returns:
        True to indicate that we should try to connect with the credentials, or False to cancel
      • isCertificateAuthorityValid

        public abstract boolean isCertificateAuthorityValid​(java.lang.String sUrl)
        This method is called by the underlying protocol code to give the application a chance to deal with a server that states that Certificate Authority is unknown. The application has the opportunity to say whether it is ok to proceed or not.
        Parameters:
        sUrl - passed in by the caller(Protocol), the url we are connecting to
        Returns:
        True to indicate that we should relax the Certificate Authority checking and use this certificate, otherwise, False to fail the connection.
      • getConnectionName

        public java.lang.String getConnectionName()
        Gets the name of our wsdl connection (wsdlConnection name="DataConnection")
        Returns:
        the current wsdl connection name
      • getConnectStatus

        public AuthenticationHandler.ConnectStatus getConnectStatus()
        Gets the status of the current connection
        Returns:
        the current status as an eConnectStatus enumerated value
      • getHandlerType

        public AuthenticationHandler.HandlerType getHandlerType()
        Gets the current handler type; client or server
        Returns:
        the current handler type as an eHandlerType enumerated value
      • getHint

        public java.lang.String getHint()
        Gets the hint used by some applications to track their certificate
        Returns:
        the current hint
      • getHost

        public java.lang.String getHost()
        Gets the Host we are dealing with (server name)
        Returns:
        the current host
      • getPassword

        public CharacterHolder getPassword()
        Gets the password, used for both transport and SOAP
        Returns:
        the current password
      • getRealm

        public java.lang.String getRealm()
        Gets the realm information
        Returns:
        the current realm
      • getSOAPAddress

        public java.lang.String getSOAPAddress()
        Gets the the http:// SOAP address.
        Returns:
        the SOAP address
      • getSOAPAuthType

        public AuthenticationHandler.AuthenticationType getSOAPAuthType()
        Gets the SOAP layer authentication type.
        Returns:
        the SOAP authentication type as an eAuthenticationType enumerated value
      • getSOAPFaultCode

        public java.lang.String getSOAPFaultCode()
        Gets the string returned in the SOAP message
        Returns:
        the SOAP fault code
      • getSOAPFaultString

        public java.lang.String getSOAPFaultString()
        Gets the returned in the SOAP message
        Returns:
        the SOAP fault string
      • getSOAPOperation

        public java.lang.String getSOAPOperation()
        Gets the name of the operation we are invoking in the SOAP message
        Returns:
        the SOAP operation
      • getSOAPRequestStatus

        public AuthenticationHandler.SOAPRequestStatus getSOAPRequestStatus()
        Gets the status of the current soap request
        Returns:
        the SOAP request status as a eSOAPRequestStatus enumerated value
      • getURL

        public java.lang.String getURL()
        Gets the URL we are dealing with
        Returns:
        the current URL
      • getTransportAuthType

        public AuthenticationHandler.AuthenticationType getTransportAuthType()
        Gets the transport layer authentication type
        Returns:
        an eAuthenticationType enumerated value indicating the type
      • getType

        public java.lang.String getType()
        Gets the type of transport authentication (basic, digest)
        Returns:
        the current type
      • getUserID

        public java.lang.String getUserID()
        Gets the user id, used for both transport and SOAP
        Returns:
        the current user id
      • logMessage

        public void logMessage​(MsgFormatPos oError)
        This method is called by the underlying Protocol code to give the application a chance to deal with a log message.
        Parameters:
        oError - Error message to log
      • reset

        public void reset()
        reset the member variables
      • setConnectionName

        public void setConnectionName​(java.lang.String sConnectionName)
        Sets the name of our wsdl connection (wsdlConnection name="DataConnection")
        Parameters:
        sConnectionName - The wsdl connection name
      • setConnectStatus

        public void setConnectStatus​(AuthenticationHandler.ConnectStatus eStatus)
        Sets the status of the current connection.
        Parameters:
        eStatus - the status as an eConnectStatus enumeration value
      • setHandlerType

        public void setHandlerType​(AuthenticationHandler.HandlerType eHandlerType)
        Sets the current Handler type (client or server)
        Parameters:
        eHandlerType - an eHandlerType enumeration value
      • setHint

        public void setHint​(java.lang.String sHint)
        Sets the a hint used by some applications to track their certificate. Client should set this.
        Parameters:
        sHint - the hint value
      • setHost

        public void setHost​(java.lang.String sHost)
        Sets the Host we are dealing with (server name). Protocol code should set this.
        Parameters:
        sHost - the host
      • setPassword

        public void setPassword​(CharacterHolder aPassword)
        Sets the password, used for both transport and SOAP. Client should set this.
        Parameters:
        aPassword - the password
      • setRealm

        public void setRealm​(java.lang.String sRealm)
        Sets the the realm information, to return to client. Protocol/SOAP code should set this.
        Parameters:
        sRealm - the realm
      • setSOAPAddress

        public void setSOAPAddress​(java.lang.String sSOAPAddress)
        Sets the the http:// SOAP address.
        Parameters:
        sSOAPAddress - the SOAP address
      • setSOAPAuthType

        public void setSOAPAuthType​(AuthenticationHandler.AuthenticationType eAuthType)
        Sets the SOAP layer authentication type.
        Parameters:
        eAuthType - the authentication type as an eAuthenticationType enumeration value
      • setSOAPFaultCode

        public void setSOAPFaultCode​(java.lang.String sSOAPFaultCode)
        Sets the string returned in the SOAP message
        Parameters:
        sSOAPFaultCode - the fault code
      • setSOAPFaultString

        public void setSOAPFaultString​(java.lang.String sSOAPFault)
        Sets the returned in the SOAP message
        Parameters:
        sSOAPFault - the fault string
      • setSOAPOperation

        public void setSOAPOperation​(java.lang.String sSOAPOperation)
        Sets the name of the operation we are invoking in the SOAP message
        Parameters:
        sSOAPOperation - the SOAP operation name
      • setSOAPRequestStatus

        public void setSOAPRequestStatus​(AuthenticationHandler.SOAPRequestStatus eSOAPStatus)
        Sets the the status of the current SOAP request
        Parameters:
        eSOAPStatus - the status as an eSOAPRequestStatus enumeration value
      • setTransportAuthType

        public void setTransportAuthType​(AuthenticationHandler.AuthenticationType eAuthType)
        Sets the current transport authentication type
        Parameters:
        eAuthType - an eAuthenticationType enumerated value
      • setType

        public void setType​(java.lang.String sType)
        Sets the type of transport authentication, to return to client. Protocol/soap code should set this.
        Parameters:
        sType - the type
      • setURL

        public void setURL​(java.lang.String sURL)
        Sets the current URL. Protocol/soap code should set this.
        Parameters:
        sURL - the URL
      • setUserID

        public void setUserID​(java.lang.String sUserID)
        Sets the current user id. Client should set this.
        Parameters:
        sUserID - the user id