Skip to content

Commit d29583d

Browse files
committed
Fix FormFactory. How did I get to here anyways?
1 parent 49c79f3 commit d29583d

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

src/Factories/FormFactory.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818

1919
use Nette\Forms\Form;
2020
use SimpleSAML\Error\Exception;
21+
use SimpleSAML\Module\oidc\Bridges\SspBridge;
2122
use SimpleSAML\Module\oidc\Forms\Controls\CsrfProtection;
2223
use SimpleSAML\Module\oidc\ModuleConfig;
2324

2425
class FormFactory
2526
{
26-
public function __construct(private readonly ModuleConfig $moduleConfig, protected CsrfProtection $csrfProtection)
27-
{
27+
public function __construct(
28+
protected readonly ModuleConfig $moduleConfig,
29+
protected readonly CsrfProtection $csrfProtection,
30+
protected readonly SspBridge $sspBridge,
31+
) {
2832
}
2933

3034
/**
@@ -39,6 +43,10 @@ public function build(string $classname): Form
3943
}
4044

4145
/** @psalm-suppress UnsafeInstantiation */
42-
return new $classname($this->moduleConfig, $this->csrfProtection);
46+
return new $classname(
47+
$this->moduleConfig,
48+
$this->csrfProtection,
49+
$this->sspBridge,
50+
);
4351
}
4452
}

src/Services/Container.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,19 @@ public function __construct()
140140
$session = Session::getSessionFromRequest();
141141
$this->services[Session::class] = $session;
142142

143-
$csrfProtection = new CsrfProtection(Translate::noop('Your session has expired. Please return to the home page and try again.'), $session);
144-
$formFactory = new FormFactory($moduleConfig, $csrfProtection);
143+
$csrfProtection = new CsrfProtection(
144+
Translate::noop('Your session has expired. Please return to the home page and try again.'),
145+
$session,
146+
);
147+
148+
$sspBridge = new SspBridge();
149+
$this->services[SspBridge::class] = $sspBridge;
150+
151+
$formFactory = new FormFactory(
152+
$moduleConfig,
153+
$csrfProtection,
154+
$sspBridge,
155+
);
145156
$this->services[FormFactory::class] = $formFactory;
146157

147158
$jsonWebKeySetService = new JsonWebKeySetService($moduleConfig);
@@ -153,9 +164,6 @@ public function __construct()
153164
$sessionMessagesService = new SessionMessagesService($session);
154165
$this->services[SessionMessagesService::class] = $sessionMessagesService;
155166

156-
$sspBridge = new SspBridge();
157-
$this->services[SspBridge::class] = $sspBridge;
158-
159167
$oidcMenu = new Menu();
160168
$this->services[Menu::class] = $oidcMenu;
161169

0 commit comments

Comments
 (0)