Example #1
0
 /**
  * Call this function to perform the authentication if a user has an OTP device.
  * It will determine which technology to use and switch to the appropriate method accordingly.
  *
  * @param Mfa_OtpdeviceDao $otpDevice The one-time password device DAO corresponding to the user
  * @param Mfa_ApitokenDao $token The current one-time password displayed on the device
  * @return true If authentication is successful, false otherwise
  * @throws Zend_Exception
  */
 public function authenticate($otpDevice, $token)
 {
     $alg = $otpDevice->getAlgorithm();
     switch ($alg) {
         case MIDAS_MFA_PAM:
             return $this->_pamAuth($otpDevice, $token);
         case MIDAS_MFA_OATH_HOTP:
             return $this->_hotpAuth($otpDevice, $token);
         case MIDAS_MFA_RSA_SECURID:
             return $this->_securIdAuth($otpDevice, $token);
         case MIDAS_MFA_RADIUS:
             return $this->_radiusauth($otpDevice, $token);
         default:
             throw new Zend_Exception('Unknown OTP algorithm for user ' . $otpDevice->getUserId());
     }
 }