OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Should 'auth' plugins be singletons?

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Should 'auth' plugins be singletons?

Postby mwood » Tue Nov 03, 2009 1:25 pm

The deeper I go into authentication plugins the more confused I get.

AuthPlugin defines a required method getInstance(settings,authId). What's it supposed to do? LDAPAuthPlugin (the only 'auth' plugin that ships with OJS) just implements it as an alias for 'new LDAPAuthPlugin'. There's no reason to have (effectively) two constructors with the same signature. Typically if you have a method called getInstance, the constructor is private and getInstance always returns a reference to a single instance generated internally, to make the class a singleton. But I can add the same 'auth' plugin more than once, with different settings (which are passed to the constructor and to getInstance) to create different authentication sources, which ought to mean that multiple instances can exist concurrently. What have I failed to understand?

The reason for all this handwringing is that I'm trying to work out how to get an instance of an 'auth' plugin initialized with the settings and authId for a given authentication source, before knowing the username. This is for building an SSO plugin -- when using an SSO provider, the most frequent case is that the user is already authenticated and we'll get the username from the provider, not the user.
mwood
 
Posts: 20
Joined: Thu Nov 01, 2007 8:06 am
Location: Indianapolis, Indiana, US

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest