Tunning IDP
* added cache to IP whitelisting checking * set redis persistent connections Change-Id: Iace8fd148e35c8b29d70bcddbd138ea557bd7f9f
This commit is contained in:
parent
9a7f7bf8fc
commit
9a5b7fdde3
@ -67,7 +67,8 @@ class BlacklistSecurityPolicy extends AbstractBlacklistSecurityPolicy
|
||||
ICacheService $cache_service,
|
||||
IResourceServerRepository $resource_server_repository,
|
||||
ITransactionService $tx_service
|
||||
) {
|
||||
)
|
||||
{
|
||||
parent::__construct($server_configuration_service, $lock_manager_service, $cache_service, $tx_service);
|
||||
$this->resource_server_repository = $resource_server_repository;
|
||||
// here we configure on which exceptions are we interested and the max occurrence attempts and initial delay on tar pit for
|
||||
@ -249,10 +250,17 @@ class BlacklistSecurityPolicy extends AbstractBlacklistSecurityPolicy
|
||||
*/
|
||||
private function isIPAddressWhiteListed($ip)
|
||||
{
|
||||
$cache_value = $this->cache_service->getSingleValue($ip.".whitelisted");
|
||||
if(!empty($cache_value)) return true;
|
||||
|
||||
$resource_server = $this->resource_server_repository->getByIp($ip);
|
||||
$white_listed_ip = $this->white_listed_ip_repository->getByIp($ip);
|
||||
|
||||
return !is_null($resource_server) || !is_null($white_listed_ip);
|
||||
$white_listed = !is_null($resource_server) || !is_null($white_listed_ip);
|
||||
if($white_listed)
|
||||
$this->cache_service->setSingleValue($ip.".whitelisted", $ip.".whitelisted");
|
||||
|
||||
return $white_listed;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,10 +100,11 @@ return [
|
||||
'cluster' => false,
|
||||
|
||||
'default' => [
|
||||
'host' => env('REDIS_HOST'),
|
||||
'port' => env('REDIS_PORT'),
|
||||
'database' => env('REDIS_DB', 0),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'host' => env('REDIS_HOST'),
|
||||
'port' => env('REDIS_PORT'),
|
||||
'database' => env('REDIS_DB', 0),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'persistent' => 1,
|
||||
],
|
||||
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user