diff --git a/config/defaultSettings.json b/config/defaultSettings.json index 4313f565..971bf2b0 100644 --- a/config/defaultSettings.json +++ b/config/defaultSettings.json @@ -26,7 +26,7 @@ "saveReqTimeout": 10, "saveRetryMax": 3, "saveRetrySleep": 5, - "requireRunToken": false, + "runTokenHash": false, "refreshControl": 0 }, "storage": { diff --git a/inc/Client.php b/inc/Client.php index fd963e9f..c40d3aeb 100644 --- a/inc/Client.php +++ b/inc/Client.php @@ -144,15 +144,10 @@ public static function getNameValidationRegex() { public static function validateRunToken( TestSwarmContext $context, $runToken ) { $conf = $context->getConf(); - if ( !$conf->client->requireRunToken ) { + if ( !$conf->client->runTokenHash ) { return true; } - $cacheFile = $conf->storage->cacheDir . '/run_token_hash.cache'; - if ( !is_readable( $cacheFile ) ) { - throw new SwarmException( 'Configuration requires a runToken but none has been configured.' ); - } - $runTokenHash = trim( file_get_contents( $cacheFile ) ); - if ( $runToken !== null && $runTokenHash === sha1( $runToken ) ) { + if ( $runToken !== null && $conf->client->runTokenHash === sha1( $runToken ) ) { return true; } throw new SwarmException( 'This TestSwarm requires a run token. Either none was entered or it is invalid.' ); diff --git a/inc/actions/GetrunAction.php b/inc/actions/GetrunAction.php index 38d16e68..b89b251d 100644 --- a/inc/actions/GetrunAction.php +++ b/inc/actions/GetrunAction.php @@ -25,7 +25,7 @@ public function doAction() { } $runToken = $request->getVal( "run_token" ); - if ( $conf->client->requireRunToken && !$runToken ) { + if ( $conf->client->runTokenHash && !$runToken ) { $this->setError( "missing-parameters", "This TestSwarm does not allow unauthorized clients to join the swarm." ); return; } diff --git a/inc/actions/PingAction.php b/inc/actions/PingAction.php index edf76235..6e08d98e 100644 --- a/inc/actions/PingAction.php +++ b/inc/actions/PingAction.php @@ -25,7 +25,7 @@ public function doAction() { } $runToken = $request->getVal( 'run_token' ); - if ( $conf->client->requireRunToken && !$runToken ) { + if ( $conf->client->runTokenHash && !$runToken ) { $this->setError( 'missing-parameters', 'This TestSwarm does not allow unauthorized clients to join the swarm.' ); return; } diff --git a/inc/actions/SaverunAction.php b/inc/actions/SaverunAction.php index 102481e5..11c5bf35 100644 --- a/inc/actions/SaverunAction.php +++ b/inc/actions/SaverunAction.php @@ -34,7 +34,7 @@ public function doAction() { } $runToken = $request->getVal( 'run_token' ); - if ( $conf->client->requireRunToken && !$runToken ) { + if ( $conf->client->runTokenHash && !$runToken ) { $this->setError( 'missing-parameters', 'This TestSwarm does not allow unauthorized clients to join the swarm.' ); return; } diff --git a/inc/pages/HomePage.php b/inc/pages/HomePage.php index 66a60ec6..867bca71 100644 --- a/inc/pages/HomePage.php +++ b/inc/pages/HomePage.php @@ -41,7 +41,7 @@ protected function initContent() { . ''; $html .= '