How can I force user login

Hi,
I would like to restrict the access to my site to a list of users which I have already in a database.

Is it possible?

Thanks
if (empty(customer::$data['id'])) die('Logged in users only!');
i did a similar thing for a liteCart project. I didnt want non members to access the cart unless they were logged in. I put this code in 
/public_html/pages/checkout.inc.php but it could easily be used to protect the entire site from non members.

<?php
if (empty(customer::$data['id'])) {
    header("Location: login?redirect_url=checkout");

} else {

  header('X-Robots-Tag: noindex');
  document::$layout = 'checkout';

  if (settings::get('catalog_only_mode')) return;

  document::$snippets['title'][] = language::translate('checkout:head_title', 'Checkout');

  breadcrumbs::add(language::translate('title_checkout', 'Checkout'));

  functions::draw_lightbox();

  $_page = new ent_view();
  echo $_page->stitch('pages/checkout');
}
tim
You don't need the else condition.

if (empty(customer::$data['id'])) {
    header('Location: document::ilink('login', ['redirect_url' => $_SERVER['REQUEST_URI']]));
    exit;
}

Same as

customer::require_login();
Agreed that's the better solution: customer::require_login();

However I don't get why there is no setting in admin to enforce login or not. There are many use cases to justify it.
tim
I don't get why there is no setting in admin to enforce login

There are many other things in queue, it just hasn't happened yet.
Was't that functionality in an earlier version of LiteCart? I seem to remember something along those lines. I could be thinking of another project though.