mirror of
https://github.com/flarum/core.git
synced 2025-07-23 01:31:40 +02:00
Add the ApiKey model as a request attribute
This commit is contained in:
@@ -35,9 +35,10 @@ class AuthenticateWithHeader implements MiddlewareInterface
|
|||||||
$id = substr($parts[0], strlen(self::TOKEN_PREFIX));
|
$id = substr($parts[0], strlen(self::TOKEN_PREFIX));
|
||||||
|
|
||||||
if (isset($parts[1])) {
|
if (isset($parts[1])) {
|
||||||
if (ApiKey::find($id)) {
|
if ($key = ApiKey::find($id)) {
|
||||||
$actor = $this->getUser($parts[1]);
|
$actor = $this->getUser($parts[1]);
|
||||||
|
|
||||||
|
$request = $request->withAttribute('apiKey', $key);
|
||||||
$request = $request->withAttribute('bypassFloodgate', true);
|
$request = $request->withAttribute('bypassFloodgate', true);
|
||||||
}
|
}
|
||||||
} elseif ($token = AccessToken::find($id)) {
|
} elseif ($token = AccessToken::find($id)) {
|
||||||
|
Reference in New Issue
Block a user