Skip to content

Commit

Permalink
Added fix to handle api keys in array and string format
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Jun 26, 2023
1 parent 55683f7 commit 7d04f7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public function save(): void

$securityConfig = $this->getSecurityConfig();
if (($this->configuration['general']['active'] ?? false) && isset($securityConfig['method']) && $securityConfig['method'] === self::SECURITYCONFIG_AUTH_APIKEY) {
if (!is_array($securityConfig['apikey'])) {
$securityConfig['apikey'] = [$securityConfig['apikey']];
}
foreach ($securityConfig['apikey'] as $apiKey) {
if (strlen($apiKey) < 16) {
throw new \Exception('API key ' . $apiKey . ' does not satisfy the minimum length of 16 characters');
Expand Down

0 comments on commit 7d04f7f

Please sign in to comment.