Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Multi authentication

From MoodleDocs

Are any of your potential issues solved if multi-auth was just another authentication plugin, like LDAP? Also, you might want to look at Pluggable Authentication Modules (PAM) as a model for all of this.