| 1 | <?php |
||
| 9 | class SocialiteAuth |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $config; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var \Closure |
||
| 18 | */ |
||
| 19 | protected $verifyUser = null; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var \Closure |
||
| 23 | */ |
||
| 24 | protected $handleNewUser = null; |
||
| 25 | |||
| 26 | public function __construct(array $config) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Provide custom logic for verifying a user before login. |
||
| 33 | * |
||
| 34 | * @param \Closure |
||
| 35 | */ |
||
| 36 | public function beforeLogin(Closure $beforeLogin) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Provide custom handler for setting up a new user. |
||
| 43 | * |
||
| 44 | * @param Closure $handleNewUser |
||
| 45 | */ |
||
| 46 | public function newUser(Closure $handleNewUser) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Verify that the user meets login requirements |
||
| 53 | * according to the custom logic provided. |
||
| 54 | * |
||
| 55 | * @param Authenticatable |
||
| 56 | * |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function verifyBeforeLogin(Authenticatable $user): bool |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param $user |
||
| 68 | * |
||
| 69 | * @return bool|Authenticatable |
||
| 70 | */ |
||
| 71 | public function handleNewUser(User $user) |
||
| 84 | } |
||
| 85 |