Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the facade aliases usage since they can be removed/changed fro… #215

Merged
merged 3 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Auth0/Login/LoginServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class LoginServiceProvider extends ServiceProvider
*/
public function boot()
{
\Auth::provider('auth0', function ($app, array $config) {
\Illuminate\Support\Facades\Auth::provider('auth0', function ($app, array $config) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to import these with use statements at the top of the file as opposed to going the inline route? Not sure if this was a technical requirement, just curious if that would be a cleaner approach otherwise.

return $app->make(Auth0UserProvider::class);
});

\Auth::extend('auth0', function ($app, $name, $config) {
\Illuminate\Support\Facades\Auth::extend('auth0', function ($app, $name, $config) {
return new RequestGuard(function (Request $request, Auth0UserProvider $provider) {
return $provider->retrieveByCredentials(['api_token' => $request->bearerToken()]);
}, $app['request'], $app['auth']->createUserProvider($config['provider']));
Expand Down Expand Up @@ -73,14 +73,14 @@ public function register()
});

// When Laravel logs out, logout the auth0 SDK trough the service
\Event::listen('auth.logout', function () {
\App::make('auth0')->logout();
\Illuminate\Support\Facades\Event::listen('auth.logout', function () {
\Illuminate\Support\Facades\App::make('auth0')->logout();
});
\Event::listen('user.logout', function () {
\App::make('auth0')->logout();
\Illuminate\Support\Facades\Event::listen('user.logout', function () {
\Illuminate\Support\Facades\App::make('auth0')->logout();
});
\Event::listen('Illuminate\Auth\Events\Logout', function () {
\App::make('auth0')->logout();
\Illuminate\Support\Facades\Event::listen('Illuminate\Auth\Events\Logout', function () {
\Illuminate\Support\Facades\App::make('auth0')->logout();
});
}
}
2 changes: 1 addition & 1 deletion src/Auth0/Login/Repository/Auth0UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getUserByUserInfo(array $userInfo) : Authenticatable
public function getUserByIdentifier($identifier) : ?Authenticatable
{
// Get the user info of the user logged in (probably in session)
$user = \App::make('auth0')->getUser();
$user = \Illuminate\Support\Facades\App::make('auth0')->getUser();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be throwing an error with our tests. Any ideas on how to work around this?


if ($user === null) {
return null;
Expand Down