Restrict Drupal route to be accessible only to registered user

There are multiple ways to deny non-authorized users - access to a route. If we're looking for a pure YAML definition solution you have a few choices.

By defining the _user_is_logged_in requirements

my.page:
  path: '/my-path'
  defaults:
    _controller: '\Drupal\my\Controller\MyController::content'
    _title: 'My Page'
  requirements:
    _user_is_logged_in: 'TRUE'

By requiring authenticated _role in requirement

my.page:
  path: '/my-path'
  defaults:
    _controller: '\Drupal\my\Controller\MyController::content'
    _title: 'My Page'
  requirements:
    _role: 'authenticated'

Last, if you need extended logic in determining weather a User should be allowed accessing a route you should look into creating a custom Access check.

********************************** ************************* ************************ **************** ****************** *********** ************** ************* ************ *************