public function getUserEntity($identity, $credential) 
	{
		$credential = $this->preProcessCredential($credential);
		$userObject = NULL;
		
		// Cycle through the configured identity sources and test each
		$fields = $this->getOptions()->getAuthIdentityFields();
		while ( !is_object($userObject) && count($fields) > 0 ) {
			$mode = array_shift($fields);
			switch ($mode) {
				case 'username':
					$userObject = $this->getMapper()->findByUsername($identity);
					break;
				case 'email':
					$userObject = $this->getMapper()->findByEmail($identity);
					break;
			}
		}
		
		if(!$userObject) {
			return null;
		}
		
		$bcrypt = new Bcrypt();
		$bcrypt->setCost($this->getOptions()->getPasswordCost());
		if (!$bcrypt->verify($credential, $userObject->getPassword())) {
			return null;
		}
		
		return $userObject;
	}