Added checks for KC being enabled (#106)

Initialisation of Auth behaviour and enrollment of users in KC, was dependent on the presence of a `keycloak` section in config.json

Added checks to ensure KC is configured as "enabled", rather than just checking if a keycloak config section was present.
pull/107/head
DocArmoryTech 2022-08-31 13:20:28 +01:00 committed by GitHub
parent 0537d05f53
commit cf565484b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -57,7 +57,9 @@ class UsersTable extends AppTable
private function initAuthBehaviors()
{
if (!empty(Configure::read('keycloak'))) {
$this->addBehavior('AuthKeycloak');
if (Configure::read('keycloak.enabled')) {
$this->addBehavior('AuthKeycloak');
}
}
}
@ -188,7 +190,9 @@ class UsersTable extends AppTable
public function enrollUserRouter($data): void
{
if (!empty(Configure::read('keycloak'))) {
$this->enrollUser($data);
if (Configure::read('keycloak.enabled')) {
$this->enrollUser($data);
}
}
}
}