/** * Attempt to create an AuthToken from user credentials. * * @param array $credentials * @return bool|AuthToken */ public function attempt(array $credentials, $userAgent) { $user = $this->users->retrieveByCredentials($credentials); if ($user instanceof UserInterface && $this->users->validateCredentials($user, $credentials)) { return $this->create($user, $userAgent); } return false; }
/** * Attempt to authenticate a user using the given credentials. * * @param array $credentials * @param bool $remember * @param bool $login * @return bool */ public function attempt(array $credentials = array(), $remember = false, $login = true) { $this->fireAttemptEvent($credentials, $remember, $login); $user = $this->provider->retrieveByCredentials($credentials); // If an implementation of UserInterface was returned, we'll ask the provider // to validate the user against the given credentials, and if they are in // fact valid we'll log the users into the application and return true. if ($user instanceof UserInterface) { if ($this->provider->validateCredentials($user, $credentials)) { if ($login) { $this->login($user, $remember); } return true; } } return false; }
/** * Determine if the user matches the credentials. * * @param mixed $user * @param array $credentials * @return bool */ protected function hasValidCredentials($user, $credentials) { return !is_null($user) && $this->provider->validateCredentials($user, $credentials); }