How do I write a new auth plugin ?

How do I write a new auth plugin ?

by George Pipkin -
Number of replies: 3
Hi -

I need to write an auth plugin to meet some special authentication needs we
have at U.Va., and I have gone over the stuff in /auth, in particular the CAS
plugin. I have a dim outline of how the thing works, but I need some specific
answer to the following questions:

1) Is there anyplace where there is a cookbook-style description of how to write an auth plugin ?

2) Absent #1, I'm assuming you set up a new directory and you need to write
a file called auth.php that extends auth_plugin_base that is found in authlib.php - that file is a pretty good description of what's needed. What I haven't figured out is how you get your plugin to appear on the list of plugins that is in the Administration->Users-Authentication page so I can turn it on.

- George Pipkin
U.Va.
Average of ratings: -
In reply to George Pipkin

Re: How do I write a new auth plugin ?

by Guido Vega -
Hi George,

As regard to point #2, Moodle is clever enough to pick it up all by itself.

You do need to modify the lang file (lang/en_utf8/auth.php) and add you entry to the $string array – don’t worry this file is pretty self-explanatory and soon as you open it up you will know what to do.

Regards,

GV
In reply to George Pipkin

Re: How do I write a new auth plugin ?

by Martín Langhoff -
Don't use CAS as your guide wink it's quite exceptionally complex and messy, in part in that it depends on LDAP. Much saner to model your plugin on a saner template.
In reply to George Pipkin

Re: How do I write a new auth plugin ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Re: 1), it looks like someone started here: http://docs.moodle.org/en/Authentication_API, but this also looks out-of-date. So better to trust the code. If possibly, as you learn to write an auth pluing your self, could you update and extend that wiki page. I am sure if you start writing it, experts will review and correct it.