You are here

function keycloak_openid_connect_userinfo_save in Keycloak OpenID Connect 8

Implements hook_openid_connect_userinfo_save().

File

./keycloak.module, line 185
Hook implementations of the Keycloak module.

Code

function keycloak_openid_connect_userinfo_save(UserInterface $account, array $context) {
  if ($context['plugin_id'] !== 'keycloak') {
    return;
  }
  $roleMatcher = \Drupal::service('keycloak.role_matcher');
  if ($roleMatcher
    ->isEnabled() && $roleMatcher
    ->hasRoleRules()) {
    $roleMatcher
      ->applyRoleRules($account, $context['user_data']);
  }
}