File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,12 @@ public static function fromPsrRequest(ServerRequestInterface $request): static
60
60
*/
61
61
public function can (string $ scope ): bool
62
62
{
63
- return in_array ('* ' , $ this ->oauth_scopes ) || $ this ->scopeExistsIn ($ scope , $ this ->oauth_scopes );
63
+ if (empty ($ this ->attributes ['oauth_scopes ' ])) {
64
+ return false ;
65
+ }
66
+
67
+ return in_array ('* ' , $ this ->attributes ['oauth_scopes ' ])
68
+ || $ this ->scopeExistsIn ($ scope , $ this ->attributes ['oauth_scopes ' ]);
64
69
}
65
70
66
71
/**
@@ -84,15 +89,31 @@ public function transient(): bool
84
89
*/
85
90
public function revoke (): bool
86
91
{
87
- return (bool ) Passport::token ()->newQuery ()->whereKey ($ this ->oauth_access_token_id )->update (['revoked ' => true ]);
92
+ if ($ this ->token ) {
93
+ return $ this ->token ->revoke ();
94
+ }
95
+
96
+ if (isset ($ this ->attributes ['oauth_access_token_id ' ])) {
97
+ return (bool ) Passport::token ()->newQuery ()->whereKey ($ this ->attributes ['oauth_access_token_id ' ])->update (['revoked ' => true ]);
98
+ }
99
+
100
+ return false ;
88
101
}
89
102
90
103
/**
91
104
* Get the token instance.
92
105
*/
93
106
protected function getToken (): ?Token
94
107
{
95
- return $ this ->token ??= Passport::token ()->newQuery ()->find ($ this ->oauth_access_token_id );
108
+ if ($ this ->token ) {
109
+ return $ this ->token ;
110
+ }
111
+
112
+ if (isset ($ this ->attributes ['oauth_access_token_id ' ])) {
113
+ return $ this ->token = Passport::token ()->newQuery ()->find ($ this ->attributes ['oauth_access_token_id ' ]);
114
+ }
115
+
116
+ return null ;
96
117
}
97
118
98
119
/**
You can’t perform that action at this time.
0 commit comments