fixes #3312 - support logout from REMOTE_USER-based logons.
fixes #3312 - when authorize_login_delegation_auth_source_user_autocreate is set, creates the unknown authenticated user.
fixes #3312 - tweaking nil tests; private.
fixes #3312 - add tests.
fixes #3312 - factor out the post-login logic from try_to_login so that it can be used for external logins as well.