hook_form_alter or overriding the routing and UserLoginForm class I am trying to add another mechanism for login into Drupal (adding an SSO function which would validate based on some criteria that a third party system will provide to Drupal).

I am trying to decide whether using hook_form_alter() (like I would in Drupal 7) is the more "Drupal 8" way or if altering the routing (shown below) so that it goes towards my custom login class that extends UserLoginForm would be a better option. I am guessing that the second approach is considered the "proper" way to do things.

Routing:

user.login:
  path: '/user/login'
  defaults:
    _form: '\Drupal\user\Form\UserLoginForm'
    _title: 'Log in'
  requirements:
    _user_is_logged_in: 'FALSE'
  options:
    _maintenance_access: TRUE


Class I would be extending in my own custom class:

class UserLoginForm extends FormBase {

}


So my real question is this - if I need to override the login mechanism (including both the SSO functionality as well as standard Drupal authentication if the SSO login fails), what is the "proper" method to do this?
I would definitely go for the second option. In my opinion the form_alter hooks are reserved for 'minor' changes to a form. I always use custom forms as much as possible (extending the original form).