In SimplesamlSubscriber:

  • \Drupal::routeMatch() should be injected into constructor of SimplesamlSubscriber.
  • \Drupal::currentUser()->isAnonymous() can be replaced with $this->account->isAnonymous().

In SimplesamlExternalauthSubscriber:

  • \Drupal::moduleHandler() should be injected into the constructor

Comments

oknate created an issue. See original summary.

oknate’s picture

Issue summary: View changes
oknate’s picture

Status: Active » Needs review
StatusFileSize
new6.34 KB
berdir’s picture

Status: Needs review » Fixed

Thanks.

  • Berdir committed 3c680ed on 8.x-3.x authored by oknate
    Issue #3052343 by oknate: Fix dependency injection in event subscribers
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

idebr’s picture

+++ b/src/EventSubscriber/SimplesamlSubscriber.php
@@ -119,7 +130,7 @@ class SimplesamlSubscriber implements EventSubscriberInterface {
+    if ($this->account->isAnonymous() && $this->routeMatcht->getRouteName() == 'user.login') {

Typo here: $this->routeMatcht

Fix is available at #3064139: Typo causing issue with direct IDP login

oknate’s picture

D'oh. That's my error. Sorry about that.