You are here

function _acquia_agent_authenticator in Acquia Connector 7.3

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent_streams.inc \_acquia_agent_authenticator()
  2. 6 acquia_agent/acquia_agent_streams.inc \_acquia_agent_authenticator()
  3. 7 acquia_agent/acquia_agent.module \_acquia_agent_authenticator()
  4. 7.2 acquia_agent/acquia_agent.module \_acquia_agent_authenticator()

Creates an authenticator based on xmlrpc params and a HMAC-SHA1.

Parameters

array $params: Params.

string $identifier: Acquia subscription identifier.

string $key: Acquia subscription key.

Return value

array Authenticator.

2 calls to _acquia_agent_authenticator()
acquia_agent_call in acquia_agent/acquia_agent.module
Prepare and send a XML-RPC request to Acquia Insight with an authenticator.
AquiaAgentUnitTestCase::testAuthenticators in acquia_agent/tests/acquia_agent.test
Test authenticators.

File

acquia_agent/acquia_agent.module, line 871
Acquia Agent securely sends information to Acquia Insight.

Code

function _acquia_agent_authenticator(array $params = array(), $identifier = NULL, $key = NULL) {
  if (empty($identifier)) {
    $identifier = acquia_agent_settings('acquia_identifier');
  }
  if (empty($key)) {
    $key = acquia_agent_settings('acquia_key');
  }
  $time = time();
  $nonce = base64_encode(hash('sha256', drupal_random_bytes(55), TRUE));
  $authenticator['identifier'] = $identifier;
  $authenticator['time'] = $time;
  $authenticator['hash'] = _acquia_agent_hmac($key, $time, $nonce, $params);
  $authenticator['nonce'] = $nonce;
  return $authenticator;
}