Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Guard
- {
- ...
- public function __construct($tokenGetter = null, $signer = null)
- {
- $this->signer = $signer ?? new Sha256();
- $this->tokenGetter = $tokenGetter ?? app(TokenGetter::class);
- }
- public function user() :? UserContract
- {
- if (is_null($this->user) === false) {
- return $this->user;
- }
- try {
- $token = $this->resolveToken($this->tokenGetter->getToken());
- } catch (TokenNotPresentException $ex) {
- return null;
- }
- $this->claims = $token->getClaims();
- return $this->user = $token->getUser();
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement