ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

How to include thirdparty auth #66

Closed syphernl closed 9 years ago

syphernl commented 9 years ago

I'd like to use one of the available LDAP packages for Laravel to add support. However, I have tried a few but all of them are not working and resulting in an exception:

Driver [ldap] not supported. 

I have tried to replace the Guard in their vendor files with yours but this doesn't work either. Any suggestions on how to get this to work?

I have tried:

But all of them end up with the same pesky error. Some packages (except for the ones listed) require replacement of the Auth provider which obviously wouldn't work. But those that simply add an additional one should right?

syphernl commented 9 years ago

I have tried the workarounds from #18 but no dice either.

tbitowner commented 9 years ago

If your multi definition is:

 'multi' => array(
    // Uses Admin Model
    'admin' => array(
        'driver' => 'admin_auth',
        'model' => 'Admin'
    ),
    // Uses Member Model
    'member' => array(
        'driver' => 'member_auth',
        'model' => 'Member'
    )
),

You should be able to call extend off the definitions:

Auth::admin()->extend('admin_auth', ...
syphernl commented 9 years ago

Awesome, seems to work fine! This really should be documented.

Thanks!

jasonspick commented 9 years ago

I'm having the same issue, I am working with strebl/l5-ldap-auth and I'm not sure how or were I extend it. is there any documentation on this?

ollieread commented 9 years ago

The documentation for this can be found on the laravel documentation, this package simply extends Auth slightly, where before you would do Auth::extend() now you do Auth::admin()->extend().