in src/main/java/com/twitter/joauth/OAuthParams.java [176:227]
private void handleKeyValue(String key, String value, boolean fromHeader) {
// TODO: This needs clean up. replace the if/else with enum/map-lookup
// Known keys can be in an enum, and parser can be updated to point to these keys, instead of creating a new key string.
// empty values for these keys are swallowed
if(BEARER_TOKEN.equals(key)) {
if (fromHeader && notEmpty(value)) {
v2Token = value;
}
} else if (CLIENT_ID.equals(key)) {
if(fromHeader && notEmpty(value)) {
consumerKey = value;
}
} else if (OAUTH_TOKEN.equals(key)) {
if (value != null) {
token = value.trim();
}
} else if (OAUTH_CONSUMER_KEY.equals(key)) {
if (notEmpty(value)) {
consumerKey = value;
}
} else if (OAUTH_NONCE.equals(key)) {
if (notEmpty(value)) {
nonce = value;
}
} else if (OAUTH_TIMESTAMP.equals(key)) {
Long timestamp = helper.parseTimestamp(value);
if (timestamp != null) {
timestampSecs = timestamp;
timestampStr = value;
}
} else if (OAUTH_SIGNATURE.equals(key)) {
if (notEmpty(value)) {
signature = helper.processSignature(value);
}
} else if (OAUTH_SIGNATURE_METHOD.equals(key)) {
if (notEmpty(value)) {
signatureMethod = value;
}
} else if (OAUTH_VERSION.equals(key)) {
if (notEmpty(value)) {
version = value;
}
} else if (key.startsWith("oauth_")) {
// send oauth_prefixed to a uniquekey handler
otherOAuthParamsHandler.handle(key, value);
} else {
// send other params to the handler, but only if they didn't come from the header
if (!fromHeader) paramsHandler.handle(key, value);
}
}