Move most of the authentication-specific code to a new file and introduce authenticator instances in order to support other authentication mechanisms (e.g. NTS).