headerType = headerType.toLowerCase();
if (authenticateHeader.toLowerCase().startsWith(headerType)) {
Map<String, String> headerEntries = StringSplitUtils.splitEachArrayElementAndCreateMap(
StringSplitUtils.splitIgnoringQuotes(authenticateHeader.substring(headerType.length()), ','), "=",
"\"");
OAuth2Exception ex = OAuth2Exception.valueOf(headerEntries);
if (ex instanceof InvalidTokenException) {
// Special case: an invalid token can be renewed so tell the caller what to do
throw new AccessTokenRequiredException(resource);
}
throw ex;