From 65d62a7c0c95cc12d451c1898d97548cd476743d Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Tue, 4 Jun 2024 17:10:35 -0400 Subject: [PATCH 1/2] Use socialite user contract instead of hard-coded `Two\User` --- README.md | 2 +- src/ProviderRedirector.php | 2 +- src/ProviderRepository.php | 2 +- src/UserProviderHandler.php | 2 +- src/UserProviderRedirector.php | 2 +- src/UserProviderRepository.php | 3 +-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 98001c5..0a32c7d 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ namespace App\Socialite; use App\Models\User; use Illuminate\Contracts\Auth\Authenticatable; use DirectoryTree\Bartender\ProviderRepository; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; class UserProviderRepository implements ProviderRepository { diff --git a/src/ProviderRedirector.php b/src/ProviderRedirector.php index 4bbff5b..ed4ef18 100644 --- a/src/ProviderRedirector.php +++ b/src/ProviderRedirector.php @@ -5,7 +5,7 @@ use Exception; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Http\RedirectResponse; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; interface ProviderRedirector { diff --git a/src/ProviderRepository.php b/src/ProviderRepository.php index 1112974..ab4aee0 100644 --- a/src/ProviderRepository.php +++ b/src/ProviderRepository.php @@ -3,7 +3,7 @@ namespace DirectoryTree\Bartender; use Illuminate\Contracts\Auth\Authenticatable; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; interface ProviderRepository { diff --git a/src/UserProviderHandler.php b/src/UserProviderHandler.php index a3057d4..10d9e8d 100644 --- a/src/UserProviderHandler.php +++ b/src/UserProviderHandler.php @@ -5,7 +5,7 @@ use Exception; use Illuminate\Http\RedirectResponse; use Laravel\Socialite\Contracts\Provider; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; class UserProviderHandler implements ProviderHandler { diff --git a/src/UserProviderRedirector.php b/src/UserProviderRedirector.php index bbb1669..0027bf5 100644 --- a/src/UserProviderRedirector.php +++ b/src/UserProviderRedirector.php @@ -8,7 +8,7 @@ use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Session; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; class UserProviderRedirector implements ProviderRedirector { diff --git a/src/UserProviderRepository.php b/src/UserProviderRepository.php index 5427c88..eda9efa 100644 --- a/src/UserProviderRepository.php +++ b/src/UserProviderRepository.php @@ -6,10 +6,9 @@ use Illuminate\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Str; -use Laravel\Socialite\Two\User as SocialiteUser; +use Laravel\Socialite\Contracts\User as SocialiteUser; class UserProviderRepository implements ProviderRepository { From 868a510db9f4c6395649b962d13969c88b0a87ee Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Tue, 4 Jun 2024 17:10:40 -0400 Subject: [PATCH 2/2] Remove unused import --- tests/UserProviderHandlerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/UserProviderHandlerTest.php b/tests/UserProviderHandlerTest.php index 32425d4..b8c412c 100644 --- a/tests/UserProviderHandlerTest.php +++ b/tests/UserProviderHandlerTest.php @@ -3,7 +3,6 @@ use DirectoryTree\Bartender\ProviderRepository; use DirectoryTree\Bartender\ProviderRedirector; use DirectoryTree\Bartender\Tests\User; -use Illuminate\Support\Facades\Auth; use Laravel\Socialite\Contracts\Provider; use Laravel\Socialite\Two\User as SocialiteUser; use DirectoryTree\Bartender\UserProviderHandler;