mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 13:25:57 +08:00
Add the ApiKey model as a request attribute
This commit is contained in:
parent
09f98a5cbb
commit
8c782a00e9
|
@ -35,9 +35,10 @@ class AuthenticateWithHeader implements MiddlewareInterface
|
|||
$id = substr($parts[0], strlen(self::TOKEN_PREFIX));
|
||||
|
||||
if (isset($parts[1])) {
|
||||
if (ApiKey::find($id)) {
|
||||
if ($key = ApiKey::find($id)) {
|
||||
$actor = $this->getUser($parts[1]);
|
||||
|
||||
$request = $request->withAttribute('apiKey', $key);
|
||||
$request = $request->withAttribute('bypassFloodgate', true);
|
||||
}
|
||||
} elseif ($token = AccessToken::find($id)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user