For our Drupal distribution we needed to redirect all anonymous users to the login page, as for now it’s implemented as a closed platform for social collaboration. The Drupal 8 way didn’t work anymore; we fixed it for Drupal 9 and published a working module.
So if you’re building a Drupal social intranet, collaboration tool or community this might help you to direct them the right way -so they don’t get an unfriendly ‘access denied’.
Keep in mind that you still have to build the correct access control into all your pages with help of permissions / access checks / advanced route access, this module doesn’t provide for that.