ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Laravel 5 compatibility #89

Closed sboo closed 9 years ago

sboo commented 9 years ago

I updated the base classes to be compatible with Laravel 5. However, the Guard dependency injection in __construct (see for example Middleware\Authenticate) doesn't work yet.

For that, the Serviceprovider needs to register this singleton correctly:

$this->app->singleton('auth.driver', function($app)
{
    return $app['auth']->driver();
});
ldynia commented 9 years ago

Hi Ramon how you resolved problem of "BindingResolutionException in Container.php line 785: Target [Illuminate\Contracts\Auth\UserProvider] is not instantiable." It appears in the constructor of the Guard class (first parameter) [ __construct(UserProvider $provider...)]?

sboo commented 9 years ago

@ldynia check my post here https://laracasts.com/discuss/channels/general-discussion/multiple-authentication-in-laravel-5-ldap-and-default-auth?page=1#reply-44260

you can use the Auth Facase instead of the Guard injection, that works for now. I haven't had time to look at it in depth yet.

ldynia commented 9 years ago

@sboo I have promble installing your fork. Could you provide me the line of code for composer installation ? I tried this but indicates that repository doesn't exist. Thanks :)

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/sboo/multiauth"
        }
    ],
    "require": {
        "sboo/multiauth" : "master",
sboo commented 9 years ago

The package is still called ""ollieread/multiauth".

Add this instead: "ollieread/multiauth" : "dev-master"

I would advise you not to use this in a production right now, or only with caution. I will work on it shorty and fix a few more things

ldynia commented 9 years ago

Thanks and it sounds awesome. I will watch it then :). Sorry @sboo I was to fast. It looks like @ollieread he didn't merge your pull request. So the package is still bind to Laravel 4.1 so I am unable to install it on Laravel 5

    "require": {
        "php": ">=5.3.0",
        "illuminate/auth": "~4.1",
        "illuminate/console": "~4.1",
        "illuminate/database": "~4.1",
        "illuminate/filesystem": "~4.1",
        "illuminate/support": "~4.1"
    },
sboo commented 9 years ago

To use my fork for now, add the following:

"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/sboo/multiauth"
        }
    ],
    "require": {
        "ollieread/multiauth" : "dev-master"
   }

This is compatible with L5

ldynia commented 9 years ago

@sboo Thanks! Finally I can install it :) I will play with it, and I will update you if I will find something suspicious. Cheers!

ollieread commented 9 years ago

Does this actually provide all of the same functionality that the 4.1 uses and that the default 5 Auth does?

sboo commented 9 years ago

There is no functional difference with your version at all, I just made it 5.0 compatible. Even 5.1, except that the default auth traits can't be used.

ollieread commented 9 years ago

Did you create replacement traits? Could you recreate this pr and merge it into my laravel5 branch please.

sboo commented 9 years ago

Will do. I haven't had time to create the traits yet, I was away until just a few days ago. Will try and do it this week.