* guard with 'remember' functionality removed. Basic auth and event emission
* has also been removed to keep this simple. Designed to be extended by external
* Auth Guards.
- *
- * @package Illuminate\Auth
*/
class ExternalBaseSessionGuard implements StatefulGuard
{
// If we've already retrieved the user for the current request we can just
// return it back immediately. We do not want to fetch the user data on
// every call to this method because that would be tremendously slow.
- if (! is_null($this->user)) {
+ if (!is_null($this->user)) {
return $this->user;
}
// First we will try to load the user using the
// identifier in the session if one exists.
- if (! is_null($id)) {
+ if (!is_null($id)) {
$this->user = $this->provider->retrieveById($id);
}
/**
* Log a user into the application without sessions or cookies.
*
- * @param array $credentials
+ * @param array $credentials
+ *
* @return bool
*/
public function once(array $credentials = [])
/**
* Log the given user ID into the application without sessions or cookies.
*
- * @param mixed $id
+ * @param mixed $id
+ *
* @return \Illuminate\Contracts\Auth\Authenticatable|false
*/
public function onceUsingId($id)
{
- if (! is_null($user = $this->provider->retrieveById($id))) {
+ if (!is_null($user = $this->provider->retrieveById($id))) {
$this->setUser($user);
return $user;
/**
* Validate a user's credentials.
*
- * @param array $credentials
+ * @param array $credentials
+ *
* @return bool
*/
public function validate(array $credentials = [])
return false;
}
-
/**
* Attempt to authenticate a user using the given credentials.
*
- * @param array $credentials
- * @param bool $remember
+ * @param array $credentials
+ * @param bool $remember
+ *
* @return bool
*/
public function attempt(array $credentials = [], $remember = false)
/**
* Log the given user ID into the application.
*
- * @param mixed $id
- * @param bool $remember
+ * @param mixed $id
+ * @param bool $remember
+ *
* @return \Illuminate\Contracts\Auth\Authenticatable|false
*/
public function loginUsingId($id, $remember = false)
{
- if (! is_null($user = $this->provider->retrieveById($id))) {
- $this->login($user, $remember);
-
- return $user;
- }
-
+ // Always return false as to disable this method,
+ // Logins should route through LoginService.
return false;
}
/**
* Log a user into the application.
*
- * @param \Illuminate\Contracts\Auth\Authenticatable $user
- * @param bool $remember
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
+ * @param bool $remember
+ *
* @return void
*/
public function login(AuthenticatableContract $user, $remember = false)
/**
* Update the session with the given ID.
*
- * @param string $id
+ * @param string $id
+ *
* @return void
*/
protected function updateSession($id)
*/
public function getName()
{
- return 'login_'.$this->name.'_'.sha1(static::class);
+ return 'login_' . $this->name . '_' . sha1(static::class);
}
/**
/**
* Set the current user.
*
- * @param \Illuminate\Contracts\Auth\Authenticatable $user
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
+ *
* @return $this
*/
public function setUser(AuthenticatableContract $user)
return $this;
}
-
}