Skip to content

Commit

Permalink
Fix group evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
buchmarv committed Aug 26, 2024
1 parent 6fef605 commit 293e6db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Security/KeyCloakAuthenticator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
declare(strict_types=1);

/*
* This file is part of the package t3g/symfony-keycloak-bundle.
Expand Down
5 changes: 2 additions & 3 deletions src/Security/KeyCloakUserProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
declare(strict_types=1);

/*
* This file is part of the package t3g/symfony-keycloak-bundle.
Expand All @@ -18,7 +18,6 @@ class KeyCloakUserProvider implements UserProviderInterface
{
private array $roleMapping;
private array $defaultRoles;
private array $userRoles = [];

public function __construct(array $roleMapping, array $defaultRoles = ['ROLE_USER', 'ROLE_OAUTH_USER'])
{
Expand All @@ -45,7 +44,7 @@ public function loadUserByIdentifier(
): KeyCloakUser {
$roles = array_intersect_key($this->roleMapping, array_flip(array_map(static function ($v) {
return str_replace('-', '_', $v);
}, $this->userRoles)));
}, $keycloakGroups)));
$roles = array_merge($roles, $scopes, $this->defaultRoles);

return new KeyCloakUser($identifier, array_values($roles), $email, $fullName, $fresh);
Expand Down

0 comments on commit 293e6db

Please sign in to comment.