File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 33namespace DesignMyNight \Laravel \OAuth2 \Guard ;
44
55use DesignMyNight \Laravel \OAuth2 \Introspect ;
6+ use Illuminate \Auth \AuthenticationException ;
67use Illuminate \Contracts \Auth \Authenticatable ;
78use Illuminate \Contracts \Auth \Guard ;
89
910class IntrospectGuard implements Guard
1011{
11- protected $ user ;
12+ protected $ user = false ;
1213
1314 public function __construct (Introspect $ introspect )
1415 {
@@ -22,7 +23,7 @@ public function authenticate()
2223
2324 public function check ()
2425 {
25- return ! is_null ($ this ->user ());
26+ return !is_null ($ this ->user ());
2627 }
2728
2829 public function guest ()
@@ -37,10 +38,14 @@ public function id()
3738
3839 public function user ()
3940 {
40- if ($ this ->user === null ) {
41- $ this ->user = $ this ->introspect
42- ->verifyToken ()
43- ->getUser ();
41+ if ($ this ->user === false ) {
42+ try {
43+ $ this ->user = $ this ->introspect
44+ ->verifyToken ()
45+ ->getUser ();
46+ } catch (AuthenticationException $ e ) {
47+ $ this ->user = null ;
48+ }
4449 }
4550
4651 return $ this ->user ;
You can’t perform that action at this time.
0 commit comments