Log when an API key is blocked due to IP restrictions
This commit is contained in:
parent
0be96cfd26
commit
6ffe5730da
2 changed files with 8 additions and 0 deletions
|
@ -6,6 +6,7 @@ use Closure;
|
|||
use IPTools\IP;
|
||||
use IPTools\Range;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Facades\Activity;
|
||||
use Laravel\Sanctum\TransientToken;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
|
@ -39,6 +40,12 @@ class AuthenticateIPAccess
|
|||
}
|
||||
}
|
||||
|
||||
Activity::event('auth:ip-blocked')
|
||||
->actor($request->user())
|
||||
->subject($request->user(), $token)
|
||||
->property('identifier', $token->identifier)
|
||||
->log();
|
||||
|
||||
throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue