Problem/Motivation

When installing intercept with Drupal 11.3 - I get the following error when accessing /user after the install.
TypeError: Drupal\intercept_ils\Auth::__construct(): Argument #3 ($user_auth) must be of type Drupal\user\UserAuth, Drupal\user\UserAuthentication given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\intercept_ils\Auth->__construct() (line 55 of modules/intercept_ils/src/Auth.php).

Steps to reproduce

Install Intercept from the profile with 11.6.x as the Drupal version and try to go to site/user and it generates this error.

Proposed resolution

Switch to using UserAuthentication instead of UserAuth which is deprecated as of 10.3 - the only issue with this is that it would require version 10.3 vs 10.x so that would require a change. The code could also be refactored to implement the generic interface vs. extending the class but that would not fix the issue as of Drupal 12 where UserAuth will be completely discontinued. So I propose and will create a MR that changes Auth.php to use the newer UserAuthentication class.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork intercept-3582728

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

robbt created an issue. See original summary.

robbt’s picture

Issue summary: View changes
attheshow’s picture

The patch/fix that we implemented for this is available in the Intercept Upstream. If you take a look at Option B in the Installation Guide (https://www.drupal.org/docs/contributed-modules/intercept/installation-g...), it mentions being sure to grab all of the patches and include them in your composer.json. Just another possible route to get this particular issue resolved! 😊

robbt’s picture

I just noticed this while adding the patches to my composer.json in following that instruction.

My first attempt at a simplified patch for this ended up breaking the intercept_events with a circular dependency warning so I'll check out that patch and see what I can learn from it.

Thanks.

robbt’s picture

Ok it looks like the patches "fix" was to patch core to still use UserAuth vs. UserAuthentication - is there any additional insights into why this was done ? I suspect the issues I ran into with the circular dependency might have something to do with it but I'm relatively new to the codebase and it seemed like my "fix" was opening up a can of worms that I wasn't ready to deal with. This is the specific error:

NOTICE: PHP message: Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "authentication_subscriber", path: "authentication_subscriber -> authentication -> authentication_collector -> intercept_event.user.authentication.cookie". in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 147 #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(450): Drupal\Component\DependencyInjection\Container->get()

So it seems like in order to switch there is more than needs to be done than just switching over to use the new UserAuthentication code.

attheshow’s picture

I think the change to UserAuthentication in core just broke a lot of things for us so we opted to undo that change in a patch. Sometimes core changes are helpful, but not always. ;)

robbt’s picture

Is there an issue queue or any place where the things that were broke were documented or was this mostly done via the team working on the sprint ? Just curious as I think when Drupal 12 comes out UserAuth will be removed completely but Drupal 11 will still be around for a while. I just prefer to adapt to core vs. patching it but I understand that development resources are often limited, so I'm assuming that if I submit a patch to switch this over it would require fixing other issues as well.

attheshow’s picture

Just looking back at my notes from 2024 for this, it looks like the issue we were experiencing was with establishing NEW Drupal accounts for customers who had never logged in with their library card number and PIN before. They were unable to log in with those and establish an account.

robbt’s picture

Ok that sounds like a major issue that would need to be figured out in order to utilize the new UserAuthentication class. I can't imagine that it would be impossible but I'm also not sure the best way of testing it. Do you remember if this issue occured while utilizing SIP2 authentication to login a new user or was this specific to the Polaris ILS module ? Ideally core patches are temporary, I think in terms of the circular dependency issue I ran into I found a way to circumvent it by modifying another service but I quit digging into it when you revealed there were other issues afoot that there would need to be a way to test against.

I also wasn't able to get this particular patch to apply on my local intercept instance installed via the profile and ddev vs. deployed with pantheon and I wasn't sure if it just needed refactored because it was trying to patch a specific version of Drupal core or if there was another issue with my environment for instance.