diff --git a/src/Fufle/ORM/Providers/PassportUserProvider.php b/src/Fufle/ORM/Providers/PassportUserProvider.php new file mode 100644 index 0000000..fbf4a5d --- /dev/null +++ b/src/Fufle/ORM/Providers/PassportUserProvider.php @@ -0,0 +1,64 @@ +model = $userModel; + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) { + if (empty($credentials)) { + return; + } + + $user = $this->model->findForPassport($credentials['username']); + + return $user; + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials Request credentials + * @return bool + */ + public function validateCredentials(Authenticatable $user, Array $credentials) { + return ($credentials['username'] == $user->getAuthIdentifier() && + md5($credentials['password']) == $user->getAuthPassword()); + } + + public function retrieveById($identifier) { + $userClass = get_class($this->model); + return $userClass::FindOrFail($identifier); + } + + public function retrieveByToken($identifier, $token) { + } + + public function updateRememberToken(Authenticatable $user, $token) { + } +} \ No newline at end of file