[1.0.x] Keycloak User Sync

Created on 26 January 2025, 3 months ago

The module Keycloak User Sync → provides the ability to sync users and their fields to Keycloak. It acts on user save, user update and user delete events. It then syncs the user account and configurable fields (user account or profile fields) over to a Keycloak instance. Access to Keycloak is done via a service user with token access (needs to be configured in Keycloak, documentation in README.md explains how to create such a user).

Project page: Keycloak User Sync →
Git-Repository: https://git.drupalcode.org/project/keycloak_user_sync

📌 Task
Status

Active

Component

module

Created by

🇦🇹Austria roromedia Linz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @roromedia
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review → gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications → , Application workflow → , What to cover in an application review → , and Tools to use for reviews → .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool → only once per application.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues → .

  • 🇮🇳India vishal.kadam Mumbai
  • 🇮🇳India vishal.kadam Mumbai

    Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

  • 🇦🇹Austria roromedia Linz
  • 🇮🇳India vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml keycloak_user_sync/
    
    FILE: keycloak_user_sync/keycloak_user_sync.module
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     29 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     31 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    FILE: keycloak_user_sync/src/Form/KeycloakUserSyncSettingsForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\keycloak_user_sync\Service\KeycloakService.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------

    2. FILE: keycloak_user_sync.module

    /**
     * @file
     * Contains keycloak_user_sync.module.
     */

    The usual description for a .module file is Hook implementations for the [module name] module. where [module name] is the module name given in the .info.yml file.

    3. FILE: src/Form/KeycloakUserSyncSettingsForm.php

    parent::__construct($config_factory);

    ConfigFormBase::__construct() requires two parameters. See the change record → .

    4. FILE: keycloak_user_sync.info.yml

    core_version_requirement: ^10 || ^11

    Given the changes in ConfigFormBase → , the module cannot be compatible with Drupal versions earlier than 10.2.0.

  • 🇦🇹Austria roromedia Linz

    Fixed mentioned issues with a new commit to 1.0.x.

  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

  • Status changed to Needs work 20 days ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
    • A specific point may just be an example and may apply in other places
    • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
    • The single review points are not ordered, not even by importance

    src/Form/KeycloakUserSyncSettingsForm.php

      /**
       * The logger service.
       *
       * @var \Psr\Log\LoggerInterface
       */
      protected $logger;

    The parent class already has an equivalent property. Child classes need to initialize that property using setLoggerFactory().

        $form['settings_info'] = [
          '#type' => 'markup',
          '#markup' => $this->t('Keycloak connection settings must be configured in settings.php or settings.local.php. Example:
            <pre>$settings[\'keycloak_user_sync.connection\'] = [
      \'url\' => \'https://keycloak.example.com\',
      \'realm\' => \'your-realm\',
    ];
    

    Since the example code is not supposed to be changed from translator people, the code should be added using a placeholder.

  • 🇦🇹Austria roromedia Linz

    Thank you for your feedback, I revised the module and fixed those issues. See the full changes in the release notes of the version tagged under 1.0.5 here: https://www.drupal.org/project/keycloak_user_sync/releases/1.0.5 →

    Those changes should fix all issues pointed out.

  • 🇮🇳India vishal.kadam Mumbai
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for your contribution and for your patience with the review process!

    I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

    These are some recommended readings to help you with maintainership:

    You can find more contributors chatting on Slack → or IRC → in #drupal-contribute. So, come hang out and stay involved → !
    Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review → . I encourage you to learn more about that process and join the group of reviewers.

    I thank the dedicated reviewers as well.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024