Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement.
 *
 */
 package gov.nist.javax.sip.header;
 
Authentication info SIP Header.

Author(s):
M. Ranganathan NIST/ITL/ANTD
Version:
1.2 $Revision: 1.10 $ $Date: 2010-05-06 14:07:50 $
Since:
1.1
 
 public final class AuthenticationInfo
     extends ParametersHeader
     implements javax.sip.header.AuthenticationInfoHeader {

    
Comment for serialVersionUID
 
     private static final long serialVersionUID = -4371927900917127057L;

    
Authentication scheme, some implemenentations require it to be set (NTLM)
 
     private String scheme;


    
Default contstructor.
 
     public AuthenticationInfo() {
         super();
         .setSeparator(); // Odd ball.
     }
 
     public void add(NameValue nv) {
         .set(nv);
     }

    
Value of header encoded in canonical form.
 
 
     protected StringBuilder encodeBody(StringBuilder buffer) {
         if ( != null)
             buffer.append().append(' ');
         return .encode(buffer);
 
     }

    
Get the name value pair for a given authentication info parameter.

Parameters:
name is the name for which we want to retrieve the name value list.
 
 
     public NameValue getAuthInfo(String name) {
         return .getNameValue(name);
     }

    
Returns the AuthenticationInfo value of this AuthenticationInfoHeader.

Returns:
the String representing the AuthenticationInfo
 
     public String getAuthenticationInfo() {
         return this.encodeBody(new StringBuilder()).toString();
     }

    
Returns the CNonce value of this AuthenticationInfoHeader.

Returns:
the String representing the cNonce information, null if value is not set.
Since:
v1.1
    public String getCNonce() {
        return this.getParameter(.);
    }

    
Returns the nextNonce value of this AuthenticationInfoHeader.

Returns:
the String representing the nextNonce information, null if value is not set.
Since:
v1.1
    public String getNextNonce() {
        return this.getParameter(.);
    }

    
Returns the Nonce Count value of this AuthenticationInfoHeader.

Returns:
the integer representing the nonceCount information, -1 if value is not set.
Since:
v1.1
    public int getNonceCount() {
        return this.getParameterAsInt(.);
    }

    
Returns the messageQop value of this AuthenticationInfoHeader.

Returns:
the string representing the messageQop information, null if the value is not set.
Since:
v1.1
    public String getQop() {
        return this.getParameter(.);
    }

    
Returns the Response value of this AuthenticationInfoHeader.

Returns:
the String representing the Response information.
Since:
v1.1
    public String getResponse() {
        return this.getParameter(.);
    }


    
Returns the "snum" value of this AuthenticationInfoHeader.

Returns:
the String representing the snum information.
    public String getSNum() {
        return this.getParameter(.);
    }

    
Returns the "srand" value of this AuthenticationInfoHeader.

Returns:
the String representing the srand information.
    public String getSRand() {
        return this.getParameter(.);
    }

    
Returns the "targetname" value of this AuthenticationInfoHeader.

Returns:
the String representing the targetname information.
    public String getTargetName() {
        return this.getParameter(.);
    }

    
Returns the authentication scheme of this AuthenticationInfoHeader.

Returns:
the String representing the scheme information or null if scheme wasn't set explicitly.
    public String getScheme() {
        return ;
    }

    
Sets the CNonce of the AuthenticationInfoHeader to the cNonce parameter value.

Parameters:
cNonce - the new cNonce String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the cNonce value.
Since:
v1.1
    public void setCNonce(String cNoncethrows ParseException {
        this.setParameter(.cNonce);
    }

    
Sets the NextNonce of the AuthenticationInfoHeader to the nextNonce parameter value.

Parameters:
nextNonce - the new nextNonce String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the nextNonce value.
Since:
v1.1
    public void setNextNonce(String nextNoncethrows ParseException {
        this.setParameter(.nextNonce);
    }

    
Sets the Nonce Count of the AuthenticationInfoHeader to the nonceCount parameter value.

Parameters:
nonceCount - the new nonceCount integer of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the nonceCount value.
Since:
v1.1
    public void setNonceCount(int nonceCountthrows ParseException {
        if (nonceCount < 0)
            throw new ParseException("bad value", 0);
        String nc = Integer.toHexString(nonceCount);
        String base = "00000000";
        nc = base.substring(0, 8 - nc.length()) + nc;
        this.setParameter(.nc);
    }

    
Sets the Qop value of the AuthenticationInfoHeader to the new qop parameter value.

Parameters:
qop - the new Qop string of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the Qop value.
Since:
v1.1
    public void setQop(String qopthrows ParseException {
        this.setParameter(.qop);
    }

    
Sets the Response of the AuthenticationInfoHeader to the new response parameter value.

Parameters:
response - the new response String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the Response.
Since:
v1.1
    public void setResponse(String responsethrows ParseException {
        this.setParameter(.response);
    }

    
Sets the SNum of the AuthenticationInfoHeader to the sNum parameter value.

Parameters:
sNum - the new sNum String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the sNum value.
    public void setSNum(String sNumthrows ParseException {
        this.setParameter(.sNum);
    }

    
Sets the SRand of the AuthenticationInfoHeader to the sRand parameter value.

Parameters:
sRand - the new sRand String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the sRand value.
    public void setSRand(String sRandthrows ParseException {
        this.setParameter(.sRand);
    }

    
Sets the TargetName of the AuthenticationInfoHeader to the targetName parameter value.

Parameters:
targetName - the new targetName String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the targetName value.
    public void setTargetName(String targetNamethrows ParseException {
        this.setParameter(.targetName);
    }

    
Sets authentication scheme name of the AuthenticationInfoHeader to the scheme parameter value.

Parameters:
scheme - the new scheme String of this AuthenticationInfoHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the targetName value.
    public void setScheme(String schemethrows ParseException {
        this. = scheme;
    }
    public void setParameter(String nameString valuethrows ParseException {
        if (name == null)
            throw new NullPointerException("null name");
        NameValue nv = super..getNameValue(name.toLowerCase());
        if (nv == null) {
            nv = new NameValue(namevalue);
            if (name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)
                || name.equalsIgnoreCase(.)) {
                if (value == null)
                    throw new NullPointerException("null value");
                if (value.startsWith(.))
                    throw new ParseException(
                        value + " : Unexpected DOUBLE_QUOTE",
                        0);
                nv.setQuotedValue();
            }
            super.setParameter(nv);
        } else
            nv.setValueAsObject(value);
    }
New to GrepCode? Check out our FAQ X