/** * @param array $saml2attributes * @param bool $retry * @return array * @throws EngineBlock_Exception * @throws EngineBlock_Exception_MissingRequiredFields */ public function registerUser(array $saml2attributes, $retry = true) { $ldapAttributes = $this->_getSaml2AttributesFieldMapper()->saml2AttributesToLdapAttributes($saml2attributes); $ldapAttributes = $this->_enrichLdapAttributes($ldapAttributes, $saml2attributes); $collabPersonId = $this->_getCollabPersonId($ldapAttributes); $users = $this->findUsersByIdentifier($collabPersonId); try { switch (count($users)) { case 1: $user = $this->_updateUser($users[0], $ldapAttributes); break; case 0: $user = $this->_addUser($ldapAttributes); break; default: $message = 'Whoa, multiple users for the same UID: "' . $collabPersonId . '"?!?!?'; $e = new EngineBlock_Exception($message); $e->userId = $collabPersonId; throw $e; } } catch (Zend_Ldap_Exception $e) { // Note that during high volumes of logins (like during a performance test) we may see a find // not returning a user, then another process registering the user, then the current process failing to // add the user because it was already added... // So if a user has already been added we simply try again if ($retry && $e->getCode() === Zend_Ldap_Exception::LDAP_ALREADY_EXISTS) { return $this->registerUser($saml2attributes, false); } else { throw new EngineBlock_Exception("LDAP failure", EngineBlock_Exception::CODE_ALERT, $e); } } return $user; }
public function __construct($message, $severity = self::CODE_NOTICE, Exception $previous = null) { parent::__construct($message, $severity, $previous); }
public function __construct($message, $remoteIdpMd5Hash) { parent::__construct($message, self::CODE_NOTICE); $this->_remoteIdpMd5Hash = $remoteIdpMd5Hash; }
/** * @param string $message * @param string $severity Defaults to EngineBlock_Exception::ALERT. * @param Exception|null $previous */ public function __construct($message, $severity = EngineBlock_Exception::CODE_ALERT, Exception $previous = null) { parent::__construct($message, $severity, $previous); }
public function __construct($message, Exception $previous = null) { parent::__construct($message, self::CODE_ALERT, $previous); }