Skip to content

Commit

Permalink
Expose refresh functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sztyup committed Jan 4, 2020
1 parent 7421c14 commit 86dc3ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/LAuth/LAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Sztyup\LAuth\Entities\Account;
use Sztyup\LAuth\Entities\User;
use Sztyup\LAuth\Events\Login;
use function get_class;

class LAuth
{
Expand Down Expand Up @@ -71,6 +72,16 @@ public function handleProviderCallback(string $providerName): User
return $user;
}

public function refreshAccount(Account $account): void
{
$map = $this->em->getClassMetadata(Account::class)->discriminatorMap;
$providerName = array_search(get_class($account), $map, true);

$provider = $this->providerRegistry->getProvider($providerName);

$provider->refresh($account);
}

protected function getUserFromAccount(Account $socialAccount): User
{
// User already associated
Expand Down

0 comments on commit 86dc3ba

Please sign in to comment.