enforce authorize with cache key for oauth routes
This commit is contained in:
parent
802d932ada
commit
7506bb790e
|
|
@ -224,29 +224,28 @@ class Nordigen
|
||||||
* isAccountActive
|
* isAccountActive
|
||||||
*
|
*
|
||||||
* @param string $account_id
|
* @param string $account_id
|
||||||
* @return bool
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function isAccountActive(string $account_id): bool
|
public function isAccountActive(string $account_id): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$account = $this->client->account($account_id)->getAccountMetaData();
|
$account = $this->client->account($account_id)->getAccountMetaData();
|
||||||
|
|
||||||
if ($account['status'] != 'READY') {
|
if ($account['status'] != 'READY') {
|
||||||
nlog("Nordigen account '{$account_id}' is not ready (status={$account['status']})");
|
nlog("Nordigen account '{$account_id}' is not ready (status={$account['status']})");
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return $account;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
nlog("Nordigen:: AccountActiveStatus:: {$e->getMessage()} {$e->getCode()}");
|
nlog("Nordigen:: AccountActiveStatus:: {$e->getMessage()} {$e->getCode()}");
|
||||||
|
|
||||||
if (strpos($e->getMessage(), 'Invalid Account ID') !== false) {
|
if (strpos($e->getMessage(), 'Invalid Account ID') !== false) {
|
||||||
return false;
|
['status' => 'Invalid Account ID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
return ['status' => 'EXPIRED'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ class BankIntegrationController extends BaseController
|
||||||
|
|
||||||
$nordigen->disabledAccountEmail($bank_integration);
|
$nordigen->disabledAccountEmail($bank_integration);
|
||||||
return;
|
return;
|
||||||
} elseif (!$is_account_active || !$account || isset($account['requisition'])) {
|
} elseif ($is_account_active['status'] != 'READY' || !$account || isset($account['requisition'])) {
|
||||||
$bank_integration->disabled_upstream = true;
|
$bank_integration->disabled_upstream = true;
|
||||||
$bank_integration->save();
|
$bank_integration->save();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class OAuthConnectRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return Cache::has($this->token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class YodleeAuthRequest extends Request
|
||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return true;
|
return Cache::has($this->state ?? $this->token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue