Forum

Thread tagged as: Question, Configuration, Addons

Perch Auth Plugins?

Hi guys,

I have a potential client requirement to support some kind of single-sign-on system that unifies admin authentication for this new site with their existing legacy websites. I would like to propose Perch to them but I'd need to be sure I could incorporate this.

I see in the config documentation that the const 'PERCH_AUTH_PLUGIN' may be defined, which sounds very promising, but I can't find any documentation about Auth plugins, any examples of Auth plugins or any forum posts of people attempting to use Auth plugins.

So are Auth plugins a thing? Is this an actual feature I can leverage? If so I can probably write an Auth plugin that does whatever they need, but I want to avoid hacking up Perch Core if I can help it so that I can stay on the normal upgrade path.

Any advice is appreciated.

Cheers

Tim Dawson

Tim Dawson 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can create an auth plugin, which is responsible for validating users and sessions. I created it a long time ago, and no one has ever really needed it, hence the lack of information.

Create your plugin at, e.g.

/perch/addons/plugins/auth/tim/auth.php

It should be a class called tim_auth_plugin extending PerchAPI_AuthPlugin.

In your config, set

define('PERCH_AUTH_PLUGIN', 'tim');

You'll need to implement any methods in PerchAPI_AuthPlugin that your system does differently.

Good to know.

Thanks Drew, I'll check it out :)

Cheers