You are here

function MoAuthApi::getHttpHeaderArray in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

File

src/Api/MoAuthApi.php, line 44

Class

MoAuthApi

Namespace

Drupal\miniorange_saml\Api

Code

function getHttpHeaderArray() {

  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
  $currentTimeInMillis = $this
    ->getTimeStamp();

  /* Creating the Hash using SHA-512 algorithm */
  $stringToHash = $this->customerId . $currentTimeInMillis . $this->apiKey;
  $hashValue = hash("sha512", $stringToHash);
  $headers = array(
    "Content-Type: application/json",
    "Customer-Key: " . $this->customerId,
    "Timestamp: " . $currentTimeInMillis,
    "Authorization: " . $hashValue,
  );
  return $headers;
}