You are here

class AuthenticationType in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Same name and namespace in other branches
  1. 8 src/AuthenticationType.php \Drupal\miniorange_2fa\AuthenticationType

@file This class represents authentication type.

Hierarchy

Expanded class hierarchy of AuthenticationType

14 files declare their use of AuthenticationType
authenticate_user.php in src/Form/authenticate_user.php
This is used to authenticate user during login.
configure_google_authenticator.php in src/Form/configure_google_authenticator.php
configure_kba.php in src/Form/configure_kba.php
configure_otp_over_sms_and_email.php in src/Form/configure_otp_over_sms_and_email.php
configure_qrcode_authentication.php in src/Form/configure_qrcode_authentication.php

... See full list

File

src/AuthenticationType.php, line 12
Contains Authentication type class.

Namespace

Drupal\miniorange_2fa
View source
class AuthenticationType {
  const laptops_phones = 'Laptops Phones';
  const feature_phones = 'Feature Phones';
  const smartphones = 'Smartphones';
  const laptops = 'Laptops';
  const landline = 'Landline';
  const hardware_token = 'hardware-token';
  public static $SMS_AND_EMAIL = array(
    'id' => 'otp-over-sms-and-email',
    'name' => 'OTP Over SMS and EMAIL',
    'code' => 'SMS AND EMAIL',
    'description' => 'You will receive a one time passcode via SMS and email. You have to enter the otp to login. Supported in Desktops, Laptops, Smartphones, Feature Phones.',
    'supported-for' => array(
      'Laptops Phones',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_sms_and_email',
    'configure-route' => 'miniorange_2fa.configure_otp_over_sms_authentication',
  );
  public static $SMS = array(
    'id' => 'otp-over-sms',
    'name' => 'OTP Over SMS',
    'code' => 'SMS',
    'description' => 'You will receive a OTP via SMS on your phone. You have to enter the otp to authenticate yourself. Supported in Smartphones, Feature Phones.',
    'supported-for' => array(
      'Feature Phones',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_sms',
    'configure-route' => 'miniorange_2fa.configure_otp_over_sms_authentication',
  );
  public static $OTP_OVER_WHATSAPP = array(
    'id' => 'otp-over-whatsapp',
    'name' => 'OTP Over WhatsApp',
    'code' => 'WHATSAPP',
    'description' => 'You will receive a one time passcode via WhatsApp message on your phone. You have to enter the otp to login. Supported in Smartphones, Laptops.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_sms_and_email',
    'configure-route' => 'miniorange_2fa.configure_otp_over_sms_authentication',
  );
  public static $OTP_OVER_EMAIL = array(
    'id' => 'otp-over-email',
    'name' => 'OTP Over Email',
    'code' => 'EMAIL',
    'description' => 'You will receive a one time passcode via an email. You have to enter the OTP on your screen authenticate yourself. Supported in Smartphones, Feature Phones.',
    'supported-for' => array(
      'Laptops',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_email',
    'configure-route' => 'miniorange_2fa.configure_otp_over_email_authentication',
  );
  public static $OTP_OVER_PHONE = array(
    'id' => 'otp-over-phone',
    'name' => 'OTP Over Phone',
    'code' => 'PHONE VERIFICATION',
    'description' => 'You will receive a one time passcode via phone call. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones.',
    'supported-for' => array(
      'Landline',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_phone',
    'configure-route' => 'miniorange_2fa.configure_otp_over_phone_authentication',
  );
  public static $EMAIL = array(
    'id' => 'email',
    'name' => 'OTP Over Email',
    'code' => 'EMAIL',
    'description' => 'You will receive a one time passcode via Email. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones.',
    'supported-for' => array(
      'Laptops',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_otp_over_email',
    'configure-route' => 'miniorange_2fa.configure_otp_over_email_authentication',
  );

  // Out of band Email
  public static $EMAIL_VERIFICATION = array(
    'id' => 'email-verification',
    'name' => 'Email Verification',
    'code' => 'OUT OF BAND EMAIL',
    'description' => 'You will receive an email with link. You have to click the <em>ACCEPT</em> or <em>DENY</em> link to verify your email. Supported in Desktops, Laptops, Smartphones.',
    'supported-for' => array(
      'Laptops',
    ),
    'challenge' => TRUE,
    'oob' => TRUE,
    'test-route' => 'miniorange_2fa.test_email_verification',
    'configure-route' => 'miniorange_2fa.configure_otp_over_sms_authentication',
  );
  public static $GOOGLE_AUTHENTICATOR = array(
    'id' => 'google-authenticator',
    'name' => 'Google Authenticator',
    'code' => 'GOOGLE AUTHENTICATOR',
    'description' => 'You have to scan the QR code from <em>Google Authenticator App</em> and enter code generated by app to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_google_authenticator',
    'configure-route' => 'miniorange_2fa.configure_google_authenticator',
  );
  public static $MICROSOFT_AUTHENTICATOR = array(
    'id' => 'microsoft-authenticator',
    'name' => 'Microsoft Authenticator',
    'code' => 'MICROSOFT AUTHENTICATOR',
    'description' => 'You have to scan the QR code from <em>Microsoft Authenticator App</em> and enter code generated by app to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_microsoft_authenticator',
    'configure-route' => 'miniorange_2fa.configure_microsoft_authenticator',
  );
  public static $AUTHY_AUTHENTICATOR = array(
    'id' => 'authy-authenticator',
    'name' => 'Authy Authenticator',
    'code' => 'AUTHY AUTHENTICATOR',
    'description' => 'You have to scan the QR code from <em>Authy Authenticator App</em> and enter code generated by app to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_authy_authenticator',
    'configure-route' => 'miniorange_2fa.configure_authy_authenticator',
  );
  public static $LASTPASS_AUTHENTICATOR = array(
    'id' => 'lastpass-authenticator',
    'name' => 'LastPass Authenticator',
    'code' => 'LASTPASS AUTHENTICATOR',
    'description' => 'You have to scan the QR code from <em>LastPass Authenticator App</em> and enter code generated by app to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_lastpass_authenticator',
    'configure-route' => 'miniorange_2fa.configure_lastpass_authenticator',
  );
  public static $DUO_AUTHENTICATOR = array(
    'id' => 'duo-authenticator',
    'name' => 'Duo Authenticator',
    'code' => 'DUO AUTHENTICATOR',
    'description' => 'You have to scan the QR code from <em>Duo Authenticator App</em> and enter code generated by app to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_duo_authenticator',
    'configure-route' => 'miniorange_2fa.configure_duo_authenticator',
  );
  public static $QR_CODE = array(
    'id' => 'qrcode-authentication',
    'name' => 'QR Code Authentication',
    'code' => 'MOBILE AUTHENTICATION',
    'description' => 'You have to scan the QR Code from your phone using <em>miniOrange Authenticator App</em> to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => TRUE,
    'oob' => TRUE,
    'test-route' => 'miniorange_2fa.test_qrcode_authentication',
    'configure-route' => 'miniorange_2fa.configure_qrcode_authentication',
  );
  public static $KBA = array(
    'id' => 'kba-authentication',
    'name' => 'Security Questions (KBA)',
    'code' => 'KBA',
    'description' => 'You have to answers some knowledge based security questions which are only known to you to authenticate yourself. Supported in Desktops, Laptops, Smartphones.',
    'supported-for' => array(
      'Laptops',
    ),
    'challenge' => TRUE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_kba_authentication',
    'configure-route' => 'miniorange_2fa.configure_kba_authentication',
  );
  public static $SOFT_TOKEN = array(
    'id' => 'soft-token',
    'name' => 'Soft Token',
    'code' => 'SOFT TOKEN',
    'description' => 'You have to enter passcode generated by <em>miniOrange Authenticator App</em> to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => FALSE,
    'oob' => FALSE,
    'test-route' => 'miniorange_2fa.test_soft_token',
    'configure-route' => 'miniorange_2fa.configure_soft_token_authentication',
  );
  public static $PUSH_NOTIFICATIONS = array(
    'id' => 'push-notifications',
    'name' => 'Push Notifications',
    'code' => 'PUSH NOTIFICATIONS',
    'description' => 'You will receive a push notification on your phone. You have to <em>ACCEPT</em> or <em>DENY</em> it to login. Supported in Smartphones only.',
    'supported-for' => array(
      'Smartphones',
    ),
    'challenge' => TRUE,
    'oob' => TRUE,
    'test-route' => 'miniorange_2fa.test_push_notifications',
    'configure-route' => 'miniorange_2fa.configure_push_notification_authentication',
  );
  public static $HARDWARE_TOKEN = array(
    'id' => 'hardware-token',
    'name' => 'Yubikey Hardware Token',
    'code' => 'HARDWARE TOKEN',
    'description' => 'You can press the button on your yubikey Hardware token which generate a random key. You can use that key to authenticate yourself.',
    'supported-for' => array(
      'hardware-token',
    ),
    'challenge' => TRUE,
    'oob' => TRUE,
    'test-route' => 'miniorange_2fa.test_hardware_token_authentication',
    'configure-route' => 'miniorange_2fa.configure_hardware_token_authentication',
  );
  public static $NOT_CONFIGURED = array(
    'id' => 'not-configured',
    'name' => 'Not Configured',
    'code' => 'NOT CONFIGURED',
    'description' => '',
    'supported-for' => array(
      'hardware-token',
    ),
    'challenge' => TRUE,
    'oob' => TRUE,
    'test-route' => 'miniorange_2fa.test_otp_over_sms_and_email',
    'configure-route' => 'miniorange_2fa.configure_otp_over_sms_authentication',
  );
  public static function getAuthType($code) {
    $arr = array(
      "SMS_AND_EMAIL" => AuthenticationType::$SMS_AND_EMAIL,
      "OTP_OVER_EMAIL" => AuthenticationType::$OTP_OVER_EMAIL,
      "EMAIL" => AuthenticationType::$EMAIL,
      "SMS" => AuthenticationType::$SMS,
      "EMAIL_VERIFICATION" => AuthenticationType::$EMAIL_VERIFICATION,
      "GOOGLE_AUTHENTICATOR" => AuthenticationType::$GOOGLE_AUTHENTICATOR,
      "MICROSOFT_AUTHENTICATOR" => AuthenticationType::$MICROSOFT_AUTHENTICATOR,
      "DUO_AUTHENTICATOR" => AuthenticationType::$DUO_AUTHENTICATOR,
      "AUTHY_AUTHENTICATOR" => AuthenticationType::$AUTHY_AUTHENTICATOR,
      "LASTPASS AUTHENTICATOR" => AuthenticationType::$LASTPASS_AUTHENTICATOR,
      "QR_CODE" => AuthenticationType::$QR_CODE,
      "KBA" => AuthenticationType::$KBA,
      "SOFT_TOKEN" => AuthenticationType::$SOFT_TOKEN,
      "PUSH_NOTIFICATIONS" => AuthenticationType::$PUSH_NOTIFICATIONS,
      "PHONE_VERIFICATION" => AuthenticationType::$OTP_OVER_PHONE,
      "HARDWARE_TOKEN" => AuthenticationType::$HARDWARE_TOKEN,
    );
    foreach ($arr as $authType) {
      if (strcasecmp($authType['code'], $code) == 0) {
        return $authType;
      }
    }
    return NULL;
  }

}

Members