diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index c9784002..fe80351f 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -32,6 +32,7 @@ use App\Services\Spectre\AuthenticationValidator as SpectreValidator; use App\Services\SimpleFIN\AuthenticationValidator as SimpleFINValidator; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Log; /** * Class ServiceController @@ -67,18 +68,21 @@ class ServiceController extends Controller public function validateSimpleFIN(): JsonResponse { + Log::debug(sprintf('Now in %s', __METHOD__)); $validator = new SimpleFINValidator(); $result = $validator->validate(); if ($result->equals(AuthenticationStatus::error())) { // send user error: + Log::error('Error: Could not validate app key.'); return response()->json(['result' => 'NOK']); } if ($result->equals(AuthenticationStatus::nodata())) { // send user error: + Log::error('No data: Could not validate app key.'); return response()->json(['result' => 'NODATA']); } - + Log::info('All OK in validateSimpleFIN.'); return response()->json(['result' => 'OK']); } diff --git a/app/Services/SimpleFIN/AuthenticationValidator.php b/app/Services/SimpleFIN/AuthenticationValidator.php index b4c79048..e837a092 100644 --- a/app/Services/SimpleFIN/AuthenticationValidator.php +++ b/app/Services/SimpleFIN/AuthenticationValidator.php @@ -28,6 +28,7 @@ namespace App\Services\SimpleFIN; use App\Services\Enums\AuthenticationStatus; use App\Services\Shared\Authentication\AuthenticationValidatorInterface; use App\Services\Shared\Authentication\IsRunningCli; +use Illuminate\Support\Facades\Log; /** * Class AuthenticationValidator @@ -39,13 +40,14 @@ class AuthenticationValidator implements AuthenticationValidatorInterface public function validate(): AuthenticationStatus { app('log')->debug(sprintf('Now at %s', __METHOD__)); - + return AuthenticationStatus::authenticated(); // needs an APP key which isn't blank or zero or whatever. $key = (string) config('app.key'); if ('' === $key) { + Log::debug('app.key is empty, cannot authenticate.'); return AuthenticationStatus::error(); } - + Log::debug('app.key is OK, can authenticate.'); return AuthenticationStatus::authenticated(); } }