Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Understanding People
Hello all. I'm loving the look of Vanilla and am very excited about getting it up and running, but my plans are a bit ambitious.
I want to plug a couple of other applications (running on the same server, of course) into Vanilla's authentication system. I've been following the development of 0.9.3 and the claims that it should make this possible, and from looking at the code and Mark's comments I've gathered that a semi-separate application called "People" now manages user authentication.
Thing is, I can't quite figure out how to utilise it from an external script. I can understand that as 0.9.3 hasn't even had a stable release yet there's little to no documentation, but I'd really appreciate some pointers with this.
Thanks.
0
This discussion has been closed.
Comments
I'd got that far, but didn't actually know how to check for a valid session.
After some playing around, though, I've got it. If anyone else wants a basic guide, here's my test code:
Thanks.
(Haha did you know that MediaWiki likes to use its own separate session so you can't read session variables from anywhere else haha I am having so much fun.)
I've written a custom authenticator (it bounces passwords off an LDAP server), but I'm not sure if I'm enabling it correctly. In my settings.php, I set $Configuration["AUTHENTICATION_MODULE"], and I enabled the class like any other extension. However, there are a few problems. In the init_*.php files, this line:
appears before
so I get an error saying it doesn't recognize my custom authenticator class. When I rearranged those two lines, I got another error because init_vanilla.php wasn't loading the Authenticator class before it loaded the extensions. So I added this line to init_vanilla.php:
Everything works now, but I wanted to know: are custom authenticators supposed to work like other extensions, or am I doing something wrong here?
The Authenticator is not really supposed to work like other extensions for exactly the reason you identified (extensions are loaded after the authenticator class has been instantiated).
There isn't really any way to make it work as an extension because of the order of operations (the authenticator *needs* to be instantiated and working long before any extensions are loaded).
As always, I'm open to suggestions on the best way to handle this. My original idea was that you would just place your custom authenticator class in the library with the Utility.Class.Authenticor.php name (renaming the other one first, of course). But now that makes the
$Context->ObjectFactory->SetReference("Authenticator", $Configuration["AUTHENTICATION_MODULE"]);
line kind of useless, doesn't it?
Perhaps I should make the AUTHENTICATION_MODULE be the name of the file that contains the authenticator class instead.
I think that's what I'll do. Right now.
I'll post an update when it's ready in a few minutes.
$Configuration["AUTHENTICATION_MODULE"] = "People.Class.Authenticator.php";
And the SetReference line has been removed from all init files. Instead, the authenticator is hard-included in every init file like this:
include($Configuration["LIBRARY_PATH"].$Configuration["AUTHENTICATION_MODULE"]);
This, of course, means that you can make a new Authenticator class like Custom.Class.Authenticator.php. You must then place that file in the library and set the reference in your conf/settings.php file like:
$Configuration["AUTHENTICATION_MODULE"] = "Custom.Class.Authenticator.php";
And you're golden. Maybe not the best solution, but like I said - I'm open to suggestions.