How to require a password when login in
Content created with drupal UI:

You need to configure proper user permissions for content. e.g. If you don't want to show content from Content type "Article" to anonymous user, Go to the permissions page (Administer > People > Permissions) and remove content view permissions for anonymous user.

Content Created programmatically :

1) Menu page :
While you register your custom menu with hook_menu, you should assign proper value to "access arguments". e.g.

/**
 * Implements hook_menu()
 */
function mymodule_menu() {
  $items['example'] = array(
    'title' =&gt; 'Example Page',
    'page callback' =&gt; 'example_page',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_SUGGESTED_ITEM,
  );
  return $items;
}


2) Custom block:

For custom blocks, you need to define your access by user role. You can assign role visibility either by drupal UI(block configuration page) or you can do same thing programmatically.
Please refer below reference.

https://drupal.stackexchange.com/a/69897/57643

After configuring user permissions over content, drupal will show access denied page if user don't have permission to view content. Its drupal's default behavior. If you want to override this behavior, you can use contributed module Redirect 403 to User Login. This will redirect user to login page instead of just showing access denied page.