Skip to content

Commit 222894e

Browse files
authored
IBX-2973: Removed obsolete random sleep on REST login (#95)
1 parent 174c190 commit 222894e

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/bundle/Resources/config/default_settings.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,3 @@ parameters:
8787
createToken:
8888
mediaType: 'JWT'
8989
href: 'router.generate("ibexa.platform.rest.create_token")'
90-
91-
# Boundary times in microseconds which the authentication check will be delayed by.
92-
ibexa.rest.authentication_min_delay_time: 30000
93-
ibexa.rest.authentication_max_delay_time: 500000

src/bundle/Resources/config/security.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ services:
1414
- "@event_dispatcher"
1515
- "@ezpublish.config.resolver"
1616
- "@?logger"
17-
- "%ibexa.rest.authentication_min_delay_time%"
18-
- "%ibexa.rest.authentication_max_delay_time%"
1917
abstract: true
2018

2119
ezpublish_rest.security.authentication.logout_handler:

src/lib/Server/Security/RestAuthenticator.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
*/
3535
class RestAuthenticator implements AuthenticatorInterface
3636
{
37-
private const DEFAULT_MIN_SLEEP_VALUE = 30000;
38-
39-
private const DEFAULT_MAX_SLEEP_VALUE = 500000;
40-
4137
/**
4238
* @var \Psr\Log\LoggerInterface
4339
*/
@@ -72,34 +68,20 @@ class RestAuthenticator implements AuthenticatorInterface
7268
*/
7369
private $logoutHandlers = [];
7470

75-
/**
76-
* @var int|null
77-
*/
78-
private $minSleepTime;
79-
80-
/**
81-
* @var int|null
82-
*/
83-
private $maxSleepTime;
84-
8571
public function __construct(
8672
TokenStorageInterface $tokenStorage,
8773
AuthenticationManagerInterface $authenticationManager,
8874
$providerKey,
8975
EventDispatcherInterface $dispatcher,
9076
ConfigResolverInterface $configResolver,
91-
LoggerInterface $logger = null,
92-
$minSleepTime = self::DEFAULT_MIN_SLEEP_VALUE,
93-
$maxSleepTime = self::DEFAULT_MAX_SLEEP_VALUE
77+
LoggerInterface $logger = null
9478
) {
9579
$this->tokenStorage = $tokenStorage;
9680
$this->authenticationManager = $authenticationManager;
9781
$this->providerKey = $providerKey;
9882
$this->dispatcher = $dispatcher;
9983
$this->configResolver = $configResolver;
10084
$this->logger = $logger;
101-
$this->minSleepTime = !is_int($minSleepTime) ? self::DEFAULT_MIN_SLEEP_VALUE : $minSleepTime;
102-
$this->maxSleepTime = !is_int($maxSleepTime) ? self::DEFAULT_MAX_SLEEP_VALUE : $maxSleepTime;
10385
}
10486

10587
/**
@@ -114,8 +96,6 @@ public function __invoke(RequestEvent $event)
11496

11597
public function authenticate(Request $request)
11698
{
117-
usleep(random_int($this->minSleepTime, $this->maxSleepTime));
118-
11999
// If a token already exists and username is the same as the one we request authentication for,
120100
// then return it and mark it as coming from session.
121101
$previousToken = $this->tokenStorage->getToken();

0 commit comments

Comments
 (0)