public function validate($username, $password)
		{

			// Store original password
			$originalPassword = $password;

			// Init model
			$this->_initModel();

			// Find user
			$modelName = $this->_model;
			$user = $modelName::find("first", array($this->_usernameField => $username));

			// Anything?
			if (is_null($user)) {
				return new AuthResult(AuthResult::USER_NOT_FOUND);
			}


			// Pre-salt password
			if ($this->_useSalt) {
				$password = $user->readAttribute($this->_saltField) . $password;
			}

			// What type of validation to do?
			$loginSuccess = false;
			$serverPassword = $user->readAttribute($this->_passwordField);
			switch ($this->_type) {
				case self::MD5:
					$loginSuccess = md5($password) == $serverPassword;
					break;
				
				case self::BLOWFISH:
					$hasher = new PasswordHash(8, false);
					$loginSuccess = $hasher->CheckPassword($password, $serverPassword);
					break;

				default:
					throw new \Exception("Unknown encryption: " . $this->_type, 1);
					break;
			}

			// Success?
			if (!$loginSuccess) {
			
				// Nope.
				return new AuthResult(AuthResult::INCORRECT_PASSWORD);

			} else {

				// Rotate the salt?
				if ($this->_rotateSalt) {

					// Now's the moment to re-encrypt the password, so we can store the newly encrypted password in the session
					$user->resaltPassword($originalPassword);
					$user->Save();

				}

				// All ok!
				return new AuthResult(AuthResult::SUCCESS, $user);

			}


		}