I found it just as easy to use the auto_login function already in the plugin.
I just uncommented the line in the constructor and manipulated it a bit to make it work with REMOTE_USER:
public function auto_login() {
if (!is_user_logged_in() && isset($_SERVER['REMOTE_USER'])) {
$user_login = end(explode('\\', $_SERVER['REMOTE_USER']));
$user = get_user_by('login', $user_login);
if ($user !== FALSE) {
$user_id = $user->ID;
wp_set_current_user($user_id, $user_login);
wp_set_auth_cookie($user_id);
do_action('wp_login', $user_login);
}
}
}
EDIT: This method doesn’t auto create users with SSO.