You are here

public function AuthenticationAPIHandler::validate in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/AuthenticationAPIHandler.php \Drupal\miniorange_2fa\AuthenticationAPIHandler::validate()

File

src/AuthenticationAPIHandler.php, line 28

Class

AuthenticationAPIHandler

Namespace

Drupal\miniorange_2fa

Code

public function validate(MiniorangeUser $user, $txId, $token, $answers = NULL) {
  $fields = array(
    'customerKey' => $user
      ->getCustomerId(),
    'username' => $user
      ->getUsername(),
    'txId' => $txId,
    'token' => $token,
    'authType' => $user
      ->getAuthType(),
    'answers' => $answers,
  );
  $json = json_encode($fields);
  $url = MoAuthConstants::$AUTH_VALIDATE_API;
  return MoAuthUtilities::callService($this->customerId, $this->apiKey, $url, $json);
}