jain.protocol.ip.sip
Class DigestCredentials

java.lang.Object
  |
  +--jain.protocol.ip.sip.Credentials
        |
        +--jain.protocol.ip.sip.DigestCredentials

public final class DigestCredentials
extends Credentials

This class represents Digest Authentication scheme Credentials. When a client receives a WWW(Proxy)AuthenticateHeader containing a DigestChallenge in a ResponseMessage it is expected to retry the RequestMessage, with a (Proxy)AuthorizationHeader, which contains DigestCredentials. The values of Opaque and Algorithm must be those supplied in the WWW(Proxy)AuthenticateHeader for the entity being requested.

  • Response: A String 32 of hex digits which proves that the user knows a password
  • UserName: User's name in the specified realm.
  • DigestURI: The URI from RequestURI of the RequestMessage; duplicated here because proxies are allowed to change the RequestURI in transit.
  • Qop: Indicates what "quality of protection" the client has applied to the message. If present, its value must be one of the alternatives the server indicated it supports in the WWW(Proxy)AuthenticateHeader. These values affect the computation of the request-digest. Note that this is a single String, not an array of alternatives as in the WWW(Proxy)AuthenticateHeader. This directive is optional in order to preserve backward compatibility with a minimal implementation of RFC 2069, but should be used if the server indicated that qop is supported by providing a Qop directive in the WWW(Proxy)AuthenticateHeader.
  • Cnonce: This must be specified if a qop directive is sent (see above), and must not be specified if the server did not send a Qop directive in the WWW(Proxy)Authenticate Header. The Cnonce value is an opaque String value by the client and used by both client and server to avoid chosen plaintext attacks, to provide mutual authentication, and to provide some message integrity protection.
  • NonceCount: This must be specified if a Qop directive is sent (see above), and must not be specified if the server did not send a Qop directive in the WWW(Proxy)AuthenticateHeader. The NonceCount value is the count of the number of RequestMessages (including the current RequestMessage) that the client has sent with the Nonce value in this RequestMessage. The purpose of this directive is to allow the server to detect RequestMessage replays by maintaining its own copy of this count - if the same Nonce Count value is seen twice, then the RequestMessage is a replay.
  • Any unrecognized directive must be ignored. If a directive or its value is improper, or required directives are missing, the proper response is BAD_REQUEST. If the request- digest is invalid, then a login failure should be logged, since repeated login failures from a single client may indicate an attacker attempting to guess passwords.

    Version:
    0.6
    See Also:
    Credentials, WWWAuthenticateHeader, ProxyAuthenticateHeader

    Constructor Summary
    DigestCredentials(java.lang.String userName, java.lang.String realm, java.lang.String nonce, java.lang.String digestURI, java.lang.String response)
              Creates DigestCredentials
     
    Method Summary
     java.lang.Object clone()
              Creates and returns a copy of DigestCredentials
     java.lang.String getAlgorithm()
              Gets algorithm of DigestCredentials
     java.lang.String getCnonce()
              Gets cnonce of DigestCredentials
     java.lang.String getDigestURI()
              Gets digestURI of DigestCredentials
     java.lang.String getNonce()
              Gets nonce of DigestCredentials
     long getNonceCount()
              Gets nonceCount of DigestCredentials
     java.lang.String getOpaque()
              Gets opaque of DigestCredentials
     java.lang.String getQop()
              Gets qop of DigestCredentials
     java.lang.String getRealm()
              Gets realm of DigestCredentials
     java.lang.String getResponse()
              Gets response of DigestCredentials
     java.lang.String getUserName()
              Gets userName of DigestCredentials
     boolean hasAlgorithm()
              Gets boolean value to indicate if the DigestCredentials has algorithm
     boolean hasCnonce()
              Gets boolean value to indicate if the DigestCredentials has cnonce
     boolean hasNonceCount()
              Gets boolean value to indicate if the DigestCredentials has nonceCount
     boolean hasOpaque()
              Gets boolean value to indicate if the DigestCredentials has opaque
     boolean hasQop()
              Gets boolean value to indicate if the DigestCredentials has qop
     void removeAlgorithm()
              Removes algorithm from DigestCredentials
     void removeCnonce()
              Removes cnonce from DigestCredentials
     void removeNonceCount()
              Removes nonceCount from DigestCredentials
     void removeOpaque()
              Removes opaque from DigestCredentials
     void removeQop()
              Removes qop from DigestCredentials
     void setAlgorithm(java.lang.String algorithm)
              Sets algorithm of DigestCredentials
     void setCnonce(java.lang.String cnonce)
              Sets cnonce of DigestCredentials
     void setDigestURI(java.lang.String digestURI)
              Sets digestURI of DigestCredentials
     void setNonce(java.lang.String nonce)
              Sets nonce of DigestCredentials
     void setNonceCount(long nonceCount)
              Sets nonceCount of DigestCredentials
     void setOpaque(java.lang.String opaque)
              Sets opaque of DigestCredentials
     void setQop(java.lang.String qop)
              Sets qop of DigestCredentials
     void setRealm(java.lang.String realm)
              Sets nonce of DigestCredentials
     void setResponse(java.lang.String response)
              Sets response of DigestCredentials
     void setUserName(java.lang.String userName)
              Sets userName of DigestCredentials
     
    Methods inherited from class jain.protocol.ip.sip.Credentials
    equals, getExtension, getExtensions, getScheme, hasExtension, hasExtensions, removeExtension, removeExtensions, setExtension, setScheme, toString
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    DigestCredentials

    public DigestCredentials(java.lang.String userName,
                             java.lang.String realm,
                             java.lang.String nonce,
                             java.lang.String digestURI,
                             java.lang.String response)
                      throws java.lang.IllegalArgumentException
    Creates DigestCredentials
    Parameters:
    userName - user name
    realm - authentication realm
    nonce - nonce
    digestURI - digest URI
    response - response
    Throws:
    java.lang.IllegalArgumentException - if any arguments are invalid
    Method Detail

    getUserName

    public java.lang.String getUserName()
    Gets userName of DigestCredentials
    Returns:
    userName of DigestCredentials

    setUserName

    public void setUserName(java.lang.String userName)
                     throws java.lang.IllegalArgumentException
    Sets userName of DigestCredentials
    Parameters:
    userName - userName
    Throws:
    java.lang.IllegalArgumentException - if userName is null or zero-length

    setNonce

    public void setNonce(java.lang.String nonce)
                  throws java.lang.IllegalArgumentException
    Sets nonce of DigestCredentials
    Parameters:
    nonce - nonce
    Throws:
    java.lang.IllegalArgumentException - if nonce is null or zero-length

    getNonce

    public java.lang.String getNonce()
    Gets nonce of DigestCredentials
    Returns:
    nonce of DigestCredentials

    getDigestURI

    public java.lang.String getDigestURI()
    Gets digestURI of DigestCredentials
    Returns:
    digestURI of DigestCredentialst

    setDigestURI

    public void setDigestURI(java.lang.String digestURI)
                      throws java.lang.IllegalArgumentException
    Sets digestURI of DigestCredentials
    Parameters:
    digestURI - digestURI
    Throws:
    java.lang.IllegalArgumentException - if digestURI is nullv

    getResponse

    public java.lang.String getResponse()
    Gets response of DigestCredentials
    Returns:
    response of DigestCredentials

    setResponse

    public void setResponse(java.lang.String response)
                     throws java.lang.IllegalArgumentException
    Sets response of DigestCredentials
    Parameters:
    response - response
    Throws:
    java.lang.IllegalArgumentException - if response is null or not 32 characters long

    getRealm

    public java.lang.String getRealm()
    Gets realm of DigestCredentials
    Returns:
    realm of DigestCredentials

    setRealm

    public void setRealm(java.lang.String realm)
                  throws java.lang.IllegalArgumentException
    Sets nonce of DigestCredentials
    Parameters:
    nonce - nonce
    Throws:
    java.lang.IllegalArgumentException - if nonce is null or zero-length

    getOpaque

    public java.lang.String getOpaque()
                               throws ParameterNotSetException
    Gets opaque of DigestCredentials
    Returns:
    opaque of DigestCredentials
    Throws:
    ParameterNotSetException - if opaque does not exist

    hasOpaque

    public boolean hasOpaque()
    Gets boolean value to indicate if the DigestCredentials has opaque
    Returns:
    boolean value to indicate if the DigestCredentials has opaque

    removeOpaque

    public void removeOpaque()
    Removes opaque from DigestCredentials

    setOpaque

    public void setOpaque(java.lang.String opaque)
                   throws java.lang.IllegalArgumentException
    Sets opaque of DigestCredentials
    Parameters:
    opaque - opaque
    Throws:
    java.lang.IllegalArgumentException - if opaque is null or zero-length

    getCnonce

    public java.lang.String getCnonce()
                               throws ParameterNotSetException
    Gets cnonce of DigestCredentials
    Returns:
    cnonce of DigestCredentials
    Throws:
    ParameterNotSetException - if cnonce does not exist

    hasCnonce

    public boolean hasCnonce()
    Gets boolean value to indicate if the DigestCredentials has cnonce
    Returns:
    boolean value to indicate if the DigestCredentials has cnonce

    removeCnonce

    public void removeCnonce()
    Removes cnonce from DigestCredentials

    setCnonce

    public void setCnonce(java.lang.String cnonce)
                   throws java.lang.IllegalArgumentException
    Sets cnonce of DigestCredentials
    Parameters:
    cnonce - cnonce
    Throws:
    java.lang.IllegalArgumentException - if cnonce is null or zero-length

    getNonceCount

    public long getNonceCount()
                       throws ParameterNotSetException
    Gets nonceCount of DigestCredentials
    Returns:
    nonceCount of DigestCredentials
    Throws:
    ParameterNotSetException - if nonceCount does not exist

    hasNonceCount

    public boolean hasNonceCount()
    Gets boolean value to indicate if the DigestCredentials has nonceCount
    Returns:
    boolean value to indicate if the DigestCredentials has nonceCount

    removeNonceCount

    public void removeNonceCount()
    Removes nonceCount from DigestCredentials

    setNonceCount

    public void setNonceCount(long nonceCount)
                       throws java.lang.IllegalArgumentException
    Sets nonceCount of DigestCredentials
    Parameters:
    nonceCount - nonce
    Throws:
    java.lang.IllegalArgumentException - if nonce is not between 0 and FFFFFFFF

    getQop

    public java.lang.String getQop()
                            throws ParameterNotSetException
    Gets qop of DigestCredentials
    Returns:
    qop of DigestCredentials
    Throws:
    ParameterNotSetException - if qop does not exist

    hasQop

    public boolean hasQop()
    Gets boolean value to indicate if the DigestCredentials has qop
    Returns:
    boolean value to indicate if the DigestCredentials has qop

    removeQop

    public void removeQop()
    Removes qop from DigestCredentials

    setQop

    public void setQop(java.lang.String qop)
                throws java.lang.IllegalArgumentException
    Sets qop of DigestCredentials
    Parameters:
    qop - qop
    Throws:
    java.lang.IllegalArgumentException - if qop is null or zero-length

    getAlgorithm

    public java.lang.String getAlgorithm()
                                  throws ParameterNotSetException
    Gets algorithm of DigestCredentials
    Returns:
    algorithm of DigestCredentials
    Throws:
    ParameterNotSetException - if algorithm does not exist

    hasAlgorithm

    public boolean hasAlgorithm()
    Gets boolean value to indicate if the DigestCredentials has algorithm
    Returns:
    boolean value to indicate if the DigestCredentials has algorithm

    removeAlgorithm

    public void removeAlgorithm()
    Removes algorithm from DigestCredentials

    setAlgorithm

    public void setAlgorithm(java.lang.String algorithm)
                      throws java.lang.IllegalArgumentException
    Sets algorithm of DigestCredentials
    Parameters:
    algorithm - nonce
    Throws:
    java.lang.IllegalArgumentException - if algorithm is null or zero-length

    clone

    public java.lang.Object clone()
    Creates and returns a copy of DigestCredentials
    Overrides:
    clone in class Credentials
    Tags copied from class: Credentials
    Returns:
    copy of Credentials


    If you have any comments or queries, please mail them to JAIN-SIP-interest@sun.com


    Copyright - 2000 Sun Microsystems