Methods Summary |
---|
public java.lang.Object | clone()Clone - do a deep copy.
Exception ex = null;
try {
AuthenticationHeader retval = (AuthenticationHeader)
this.getClass().newInstance();
if (this.scheme != null) retval.scheme = new String(this.scheme);
if (this.parameters != null)
retval.parameters = (NameValueList)parameters.clone();
return retval;
} catch (InstantiationException ie) {
ex = ie;
} catch (IllegalAccessException iae) {
ex = iae;
}
if (ex != null) {
InternalErrorHandler.handleException(ex);
}
return null;
|
public java.lang.String | encodeBody()Encodes in canonical form.
return this.scheme + Separators.SP + parameters.encode();
|
public boolean | equals(java.lang.Object that)Compares for equivalence.
if (! that.getClass().equals(this.getClass())) {
return false;
} else {
AuthenticationHeader other = (AuthenticationHeader) that;
return (equalsIgnoreCase(this.scheme, other.scheme) &&
this.parameters.equals(other.parameters));
}
|
public java.lang.String | getAlgorithm()Returns the Algorithm value of this WWWAuthenicateHeader.
return getParameter(ALGORITHM);
|
public java.lang.String | getCNonce()Get the CNonce.
return getParameter(CNONCE);
|
public java.lang.String | getDomain()Returns the Domain value of this WWWAuthenicateHeader.
return getParameter(DOMAIN);
|
public java.lang.String | getNonce()Returns the Nonce value of this WWWAuthenicateHeader.
return getParameter(NONCE);
|
public int | getNonceCount()Counts the nonce.
return this.getParameterAsHexInt(NC);
|
public java.lang.String | getOpaque()Returns the Opaque value of this WWWAuthenicateHeader.
return getParameter(OPAQUE);
|
public java.lang.String | getParameter(java.lang.String name)Returns the value of the named parameter, or null if it is not set. A
zero-length String indicates flag parameter.
String returnValue = super.getParameter(name);
if ((returnValue != null) && isQuoted(name)) { // remove quotes
returnValue = returnValue.substring(1, returnValue.length() - 1);
}
return returnValue;
|
public java.lang.String | getQop()Returns the Qop value of this WWWAuthenicateHeader.
return getParameter(QOP);
|
public java.lang.String | getRealm()Returns the Realm value of this WWWAuthenicateHeader. This convenience
method returns only the realm of the complete Challenge.
return getParameter(REALM);
|
public java.lang.String | getResponse()Gets the RESPONSE value (or null if it does not exist).
return (String) getParameterValue(RESPONSE);
|
public java.lang.String | getScheme()Returns the scheme of the challenge information for this
AuthenticationHeaderHeader.
return scheme;
|
public URI | getURI()Returns the URI value of this WWWAuthenicateHeader,
for example DigestURI.
return getParameterAsURI(URI);
|
public java.lang.String | getUsername()Returns the Username value of this AuthorizationHeader.
This convenience method returns only the username of the
complete Response.
return (String) getParameter
(USERNAME);
|
public java.lang.Object | getValue()Gets the value of the header (just returns the scheme).
return getScheme();
|
private boolean | isQuoted(java.lang.String name)Returns true if parameter must be quoted, else - false.
zero-length String indicates flag parameter.
if (equalsIgnoreCase(name, QOP) ||
equalsIgnoreCase(name, REALM) ||
equalsIgnoreCase(name, URI) ||
equalsIgnoreCase(name, CNONCE) ||
equalsIgnoreCase(name, NONCE) ||
equalsIgnoreCase(name, USERNAME) ||
equalsIgnoreCase(name, DOMAIN) ||
equalsIgnoreCase(name, OPAQUE) ||
equalsIgnoreCase(name, NEXT_NONCE) ||
equalsIgnoreCase(name, RESPONSE)) {
return true;
}
return false;
|
public boolean | isStale()Returns the boolean value of the state paramater of this
WWWAuthenicateHeader.
return this.getParameterAsBoolean(STALE);
|
public void | setAlgorithm(java.lang.String algorithm)Sets the Algorithm of the WWWAuthenicateHeader to the new
algorithm parameter value.
if (algorithm == null)
throw new NullPointerException("null arg");
setParameter(ALGORITHM, algorithm);
|
public void | setCNonce(java.lang.String cnonce)Set the CNonce.
this.setParameter(CNONCE, cnonce);
|
public void | setDomain(java.lang.String domain)Sets the Domain of the WWWAuthenicateHeader to the domain
parameter value.
if (domain == null)
throw new NullPointerException("null arg");
setParameter(DOMAIN, domain);
|
public void | setNonce(java.lang.String nonce)Sets the Nonce of the WWWAuthenicateHeader to the nonce
parameter value.
if (nonce == null)
throw new NullPointerException("null nonce");
setParameter(NONCE, nonce);
|
public void | setNonceCount(int nonceCount)Set the nonce count parameter.
if (nonceCount < 0)
throw new IllegalArgumentException("bad value");
String nc = Integer.toHexString(nonceCount);
String base = "00000000";
nc = base.substring(0, 8 - nc.length()) + nc;
this.setParameter(NC, nc);
|
public void | setOpaque(java.lang.String opaque)Sets the Opaque value of the WWWAuthenicateHeader to the new
opaque parameter value.
if (opaque == null)
throw new NullPointerException("null arg");
setParameter(OPAQUE, opaque);
|
public void | setParameter(NameValue nv)Sets the specified parameter.
Object val = nv.getValue();
setParameter(nv.getName(), (val == null) ? null : val.toString());
|
public void | setParameter(java.lang.String name, java.lang.String value)Sets the specified parameter.
NameValue nv =
super.parameters.getNameValue(name.toLowerCase());
boolean quotedParam = false;
if (isQuoted(name)) {
if (value == null) {
throw new NullPointerException("null value");
}
quotedParam = true;
boolean quoteStart = value.startsWith(Separators.DOUBLE_QUOTE);
boolean quoteEnd = value.endsWith(Separators.DOUBLE_QUOTE);
if ((quoteStart && !quoteEnd) || (!quoteStart && quoteEnd)) {
throw new IllegalArgumentException
(value + " : Unexpected DOUBLE_QUOTE");
}
if (quoteStart) { // quoteEnd is true in this case
value = value.substring(1, value.length() - 1);
}
}
if (nv == null) {
nv = new NameValue(name.toLowerCase(), value);
if (quotedParam) {
nv.setQuotedValue();
}
super.setParameter(nv);
} else {
nv.setValue(value);
}
|
public void | setQop(java.lang.String qop)Sets the Qop value of the WWWAuthenicateHeader to the new
qop parameter value.
if (qop == null)
throw new NullPointerException("null arg");
setParameter(QOP, qop);
|
public void | setRealm(java.lang.String realm)Sets the Realm of the WWWAuthenicateHeader to the realm
parameter value. Realm strings MUST be globally unique. It is
RECOMMENDED that a realm string contain a hostname or domain name.
Realm strings SHOULD present a human-readable identifier that can be
rendered to a user.
if (realm == null)
throw new NullPointerException("null realm");
setParameter(REALM, realm);
|
public void | setResponse(java.lang.String response)Sets the Response.
if (response == null)
throw new NullPointerException("Null parameter");
this.setParameter(RESPONSE, response);
|
public void | setScheme(java.lang.String scheme)Sets the scheme of the challenge information for this
AuthenticationHeaderHeader. For example, Digest.
this.scheme = scheme;
|
public void | setStale(boolean stale)Sets the value of the stale parameter of the WWWAuthenicateHeader to the
stale parameter value.
setParameter(new NameValue(STALE, new Boolean(stale)));
|
public void | setURI(URI uri)Sets the URI of the WWWAuthenicateHeader to the uri
parameter value.
if (uri != null) {
NameValue nv = new NameValue(URI, uri);
nv.setQuotedValue();
super.parameters.set(nv);
} else {
throw new NullPointerException("Null URI");
}
|
public void | setUsername(java.lang.String username)Sets the Username of the AuthorizationHeader to
the username parameter value.
this.setParameter(USERNAME, username);
|