use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Guard;
+use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;
use Symfony\Component\HttpFoundation\Request;
throw new ApiAuthException(trans('errors.api_incorrect_token_secret'));
}
+ $now = Carbon::now();
+ if ($token->expires_at <= $now) {
+ throw new ApiAuthException(trans('errors.api_user_token_expired'), 403);
+ }
+
if (!$token->user->can('access-api')) {
throw new ApiAuthException(trans('errors.api_user_no_api_permission'), 403);
}
return Hash::check($credentials['secret'], $token->secret);
}
+ /**
+ * "Log out" the currently authenticated user.
+ */
+ public function logout()
+ {
+ $this->user = null;
+ }
}
\ No newline at end of file