* The header value to parse.
* @return The equivalent {@link AuthenticationInfo} instance.
* @throws IOException
*/
public static AuthenticationInfo parseAuthenticationInfo(String header) {
AuthenticationInfo result = null;
ParameterReader hr = new ParameterReader(header);
try {
String nextNonce = null;
String qop = null;
String responseAuth = null;
String cnonce = null;
int nonceCount = 0;
Parameter param = hr.readValue();
while (param != null) {
try {
if ("nextnonce".equals(param.getName())) {
nextNonce = param.getValue();
} else if ("qop".equals(param.getName())) {
qop = param.getValue();
} else if ("rspauth".equals(param.getName())) {
responseAuth = param.getValue();
} else if ("cnonce".equals(param.getName())) {
cnonce = param.getValue();
} else if ("nc".equals(param.getName())) {
nonceCount = Integer.parseInt(param.getValue(), 16);
}
if (hr.skipValueSeparator()) {
param = hr.readValue();
} else {
param = null;
}
} catch (Exception e) {
Context.getCurrentLogger()
.log(Level.WARNING,
"Unable to parse the authentication info header parameter",
e);
}
}
result = new AuthenticationInfo(nextNonce, nonceCount, cnonce, qop,
responseAuth);
} catch (IOException e) {
Context.getCurrentLogger()
.log(Level.WARNING,
"Unable to parse the authentication info header: "