}
// If we have a token, make sure that this token is
// identical to it.
else if(! authToken.equals(cookie.getValue())) {
throw
new InvalidAuthenticationException(
"Multiple, different authentication " +
"token cookies were given.");
}
}
}
}
}
// Get the authentication tokens from the parameters.
boolean authTokenIsFromParameters = false;
String[] authTokenParameters =
request
.getParameterValues(Version1.PARAM_AUTHENTICATION_AUTH_TOKEN);
// If any authentication token parameters exist, validate that there is
// only one and then remember it.
if(authTokenParameters != null) {
// Cycle through the array and check all of the authentication
// tokens.
for(int i = 0; i < authTokenParameters.length; i++) {
// As long as their is one element in the array, this can be
// set. If there is a problem with the input, this being set
// will be irrelevant.
authTokenIsFromParameters = true;
// If we have not yet found a token, save this one.
if(authToken == null) {
authToken = authTokenParameters[i];
}
// If we have a token, make sure that this token is
// identical to it.
else if(! authToken.equals(authTokenParameters[i])) {
throw
new InvalidAuthenticationException(
"Multiple, different authentication token " +
"parameters were given.");
}
}
}
// If we found a token, store it.
if(authToken != null) {
// Attempt to get the authentication token.
AuthenticationToken authTokenObject =
AuthenticationTokenBin.getInstance().getToken(authToken);
if(authTokenObject == null) {
throw
new InvalidAuthenticationException(
"The authentication token is unknown or has expired.");
}
// Associate the authentication token with the request.
request