[Solar-talk] Alternate authentication object for Solar_User

Leo Chiao leo.chiao at gmail.com
Mon Mar 17 10:45:07 CDT 2008


Paul,

In your suggestion for writing a adapter to manage multiple auth stores,
wouldn't that necessitate the need to also write an alternative to
Solar_Auth_Adapter as there would no longer a single "auth" instance to
authenticate against.  For example auth->isValid() would not work as there
would be two auth stores.

Let me explain my situation in a little more detail.  I am developing an
e-commerce app where you can create multiple stores. To start, there is a
users table where consumers account information is stored as in any normal
store and that is the first authentication source.  The second auth source
is for the scenario where a store requires a unique login/password just to
view the store. There is no relationship between the two auth sources for
various business reasons.

If my explanation is clear, do you still go with your original
recommendation versus using two Solar_User instances?



On Mon, Mar 17, 2008 at 9:33 AM, Paul M Jones <pmjones at paul-m-jones.com>
wrote:

>
> On Mar 16, 2008, at 19:59 , Leo Chiao wrote:
>
> > In the current app I am developing, I need to use two distinct
> > authentication sources so I am planning to use two Solar_User
> > objects: one which uses the default Solar_Auth settings I have
> > defined in my config file and the other with a custom config
> > setting.  To accomplish this, I am calling
> > Solar::factory('Solar_User') with the optional $config as the second
> > constructor param.
> >
> > For most config parameters, they are either integers or strings, but
> > Solar_User expects an actual authentication object which means I
> > have to specify the config via code.  I just wanted to confirm that
> > there isn't a more elegant way to accomplish this:
> >
> > if (! Solar_Registry::exists('user')) {
> >     Solar_Registry::set('user', Solar::factory('Solar_User'));
> > }
> >
> > if (! Solar_Registry::exists('member')) {
> >     $config = array(
> >         'auth' => Solar::factory('Solar_Auth',
> > Solar::config('Vendor_Auth'))
> >     );
> >     Solar_Registry::set('member', Solar::factory('Solar_User',
> > $config));
> > }
>
> My initial suggestion would be to write a custom authentication
> adapter that examines both auth sources (called, e.g.,
> Vendor_Auth_Adapter_Dual).  You can then set the Solar config for
> Solar_Auth to default to your custom adapter in the config file:
>
>     $config['Solar_Auth']['adapter'] = 'Vendor_Auth_Adapter_Dual';
>
> Solar_User will automatically pick up the new adapter through its
> (Solar_User's) dependency.
>
> That way you don't need two separate user objects just to use two
> different auth stores simultaneously.
>
> Given my limited understanding of your situation, I hope that makes
> sense; please let me know if it does not.
>
>
> -- pmj
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20080317/68354d97/attachment.html


More information about the Solar-talk mailing list