What hook to use to redirect based on $post

add_action( 'pre_get_posts', 'mytheme_restrict_user_content' );

function mytheme_restrict_user_content( $query ){
  $restricted_post_types = array('documentlibrary', 'events');
  if ( is_main_query() && is_singular($restricted_post_types) && ! is_user_logged_in() ) {
    $redirect = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    wp_redirect( wp_login_url($redirect, true) );
    exit();
  }
}

I don’t use auth_redirect because that function check if the user is logged in, but we already know that user is not logged in.