public static function DrupalOAuthClient::signatureMethod in OAuth 1.0 7.4
Same name and namespace in other branches
- 6.3 includes/DrupalOAuthClient.inc \DrupalOAuthClient::signatureMethod()
- 7.3 includes/DrupalOAuthClient.inc \DrupalOAuthClient::signatureMethod()
Convenience function to get signing method implementations.
Parameters
string $method: Optional. The hmac hashing algorithm to use. Defaults to 'sha512' which has superseded sha1 as the recommended alternative.
bool $fallback_to_sha1: Optional. Whether sha1 should be used as a fallback if the selected hashing algorithm is unavailable.
Return value
OAuthSignatureMethod The signature method object.
1 call to DrupalOAuthClient::signatureMethod()
- DrupalOAuthClient::__construct in includes/
DrupalOAuthClient.inc - Creates an instance of the DrupalOAuthClient.
File
- includes/
DrupalOAuthClient.inc, line 56
Class
Code
public static function signatureMethod($method = 'SHA1', $fallback_to_sha1 = TRUE) {
$sign = NULL;
if (in_array(drupal_strtolower($method), hash_algos())) {
$sign = new OAuthSignatureMethod_HMAC($method);
}
else {
if ($fallback_to_sha1) {
$sign = new OAuthSignatureMethod_HMAC('SHA1');
}
}
return $sign;
}