jain.protocol.ip.sip
Class Challenge

java.lang.Object
  |
  +--jain.protocol.ip.sip.Challenge
Direct Known Subclasses:
BasicChallenge, DigestChallenge

public class Challenge
extends java.lang.Object
implements java.lang.Cloneable

This class represents a generic SIP authentication challenge. SIP provides a simple challenge-response authentication mechanism which may be used by a proxy or user agent server to challenge a client RequestMessage and by a client to provide authentication information. It uses an extensible token to identify the authentication Scheme. The Realm is a string to be displayed to users so they know which username and password to use. This string should contain at least the name of the host performing the authentication and might additionally indicate the collection of users who might have access. It is required for all authentication schemes which issue a challenge.

Version:
0.6
See Also:
WWWAuthenticateHeader, ProxyAuthenticateHeader, BasicChallenge, DigestChallenge

Constructor Summary
Challenge(java.lang.String scheme)
          Creates a Challenge based on given authentication scheme and realm
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of Challenge
 boolean equals(Challenge challenge)
          Indicates whether some other Challenge is "equal to" this one
 java.lang.String getExtension(java.lang.String extension)
          Gets the value of specified parameter in Challenge
 java.lang.String[] getExtensions()
          Gets an array of Challenge's parameter names
 java.lang.String getRealm()
          Gets authentication realm
 java.lang.String getScheme()
          Gets authentication scheme
 boolean hasExtension(java.lang.String extension)
          Gets boolean value to indicate if the Challenge has specified extension parameter
 boolean hasExtensions()
          Gets boolean value to indicate if the Challenge has extension parameters
 void removeExtension(java.lang.String extension)
          Removes specified extension parameter from Challenge
 void removeExtensions()
          Removes all extension parameters from Challenge
 void setExtension(java.lang.String extension, java.lang.String value)
          Sets value of parameter to value in Challenge
 void setRealm(java.lang.String realm)
          Sets authentication realm
 void setScheme(java.lang.String scheme)
          Sets authentication scheme
 java.lang.String toString()
          Gets string representation of Challenge
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Challenge

public Challenge(java.lang.String scheme)
          throws java.lang.IllegalArgumentException
Creates a Challenge based on given authentication scheme and realm
Parameters:
scheme - authentication scheme
realm - authentication realm
Throws:
java.lang.IllegalArgumentException - if scheme or realm are null or zero-length
Method Detail

setScheme

public void setScheme(java.lang.String scheme)
               throws java.lang.IllegalArgumentException
Sets authentication scheme
Parameters:
scheme - the authentication scheme
Throws:
java.lang.IllegalArgumentException - if scheme is null or zero-length

getScheme

public java.lang.String getScheme()
Gets authentication scheme
Returns:
authentication scheme

getRealm

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

setRealm

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

removeExtension

public void removeExtension(java.lang.String extension)
Removes specified extension parameter from Challenge
Parameters:
extension - extension parameter to remove from Challenge

removeExtensions

public void removeExtensions()
Removes all extension parameters from Challenge

getExtension

public java.lang.String getExtension(java.lang.String extension)
                              throws ParameterNotSetException
Gets the value of specified parameter in Challenge
Parameters:
parameter - parameter to retrieve
Returns:
the value of specified parameter in Challenge
Throws:
ParameterNotSetException - if the extension does not exist

getExtensions

public java.lang.String[] getExtensions()
                                 throws ParameterNotSetException
Gets an array of Challenge's parameter names
Returns:
an array of Challenge's parameter names
Throws:
ParameterNotSetException - if no extensions exist

hasExtensions

public boolean hasExtensions()
Gets boolean value to indicate if the Challenge has extension parameters
Returns:
boolean value to indicate if the Challenge has parameters

hasExtension

public boolean hasExtension(java.lang.String extension)
Gets boolean value to indicate if the Challenge has specified extension parameter
Returns:
boolean value to indicate if the Challenge has specified extension parameter

setExtension

public void setExtension(java.lang.String extension,
                         java.lang.String value)
Sets value of parameter to value in Challenge
Parameters:
parameter - name of parameter
value - value of parameter
Throws:
java.lang.IllegalArgumentException - if parameter or value are null or zero-length

toString

public java.lang.String toString()
Gets string representation of Challenge
Overrides:
toString in class java.lang.Object
Returns:
string representation of Challenge

clone

public java.lang.Object clone()
Creates and returns a copy of Challenge
Returns:
copy of Challenge

equals

public boolean equals(Challenge challenge)
Indicates whether some other Challenge is "equal to" this one
Parameters:
challenge - the Challenge with which to compare


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


Copyright - 2000 Sun Microsystems