You are here

class CasLoginException in CAS 8

Same name and namespace in other branches
  1. 2.x src/Exception/CasLoginException.php \Drupal\cas\Exception\CasLoginException

Class CasLoginException.

Hierarchy

  • class \Drupal\cas\Exception\CasLoginException extends \Drupal\cas\Exception\Exception

Expanded class hierarchy of CasLoginException

4 files declare their use of CasLoginException
BulkAddCasUsers.php in src/Form/BulkAddCasUsers.php
CasUserManager.php in src/Service/CasUserManager.php
ServiceController.php in src/Controller/ServiceController.php
ServiceControllerTest.php in tests/src/Unit/Controller/ServiceControllerTest.php

File

src/Exception/CasLoginException.php, line 8

Namespace

Drupal\cas\Exception
View source
class CasLoginException extends \Exception {

  /**
   * Auto registration turned off, and local account does not exist.
   */
  const NO_LOCAL_ACCOUNT = 1;

  /**
   * Auto reg turned on, but subscriber denied auto reg.
   */
  const SUBSCRIBER_DENIED_REG = 2;

  /**
   * Could not log user in, because Drupal account is blocked.
   */
  const ACCOUNT_BLOCKED = 3;

  /**
   * Event listener prevented login.
   */
  const SUBSCRIBER_DENIED_LOGIN = 4;

  /**
   * Error parsing CAS attributes during login.
   */
  const ATTRIBUTE_PARSING_ERROR = 5;

  /**
   * Auto registration attempted to register Drupal user that already exists.
   */
  const USERNAME_ALREADY_EXISTS = 6;

  /**
   * A user message when login failed on a subscriber cancellation.
   *
   * @var \Drupal\Component\Render\MarkupInterface|string;
   */
  protected $subscriberCancelReason;

  /**
   * Sets a user message when login failed on a subscriber cancellation.
   *
   * @param \Drupal\Component\Render\MarkupInterface|string $reason
   *   A user message to be set along with the exception.
   *
   * @return $this
   */
  public function setSubscriberCancelReason($reason) {
    if ($this
      ->getCode() === self::SUBSCRIBER_DENIED_LOGIN) {
      $this->subscriberCancelReason = $reason;
    }
    return $this;
  }

  /**
   * Returns the user message if login failed on a subscriber cancellation.
   *
   * @return \Drupal\Component\Render\MarkupInterface|string|null
   *   The reason why login failed, if any.
   */
  public function getSubscriberCancelReason() {
    return $this->subscriberCancelReason;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CasLoginException::$subscriberCancelReason protected property A user message when login failed on a subscriber cancellation.
CasLoginException::ACCOUNT_BLOCKED constant Could not log user in, because Drupal account is blocked.
CasLoginException::ATTRIBUTE_PARSING_ERROR constant Error parsing CAS attributes during login.
CasLoginException::getSubscriberCancelReason public function Returns the user message if login failed on a subscriber cancellation.
CasLoginException::NO_LOCAL_ACCOUNT constant Auto registration turned off, and local account does not exist.
CasLoginException::setSubscriberCancelReason public function Sets a user message when login failed on a subscriber cancellation.
CasLoginException::SUBSCRIBER_DENIED_LOGIN constant Event listener prevented login.
CasLoginException::SUBSCRIBER_DENIED_REG constant Auto reg turned on, but subscriber denied auto reg.
CasLoginException::USERNAME_ALREADY_EXISTS constant Auto registration attempted to register Drupal user that already exists.