File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 1818
1919use Nette \Forms \Form ;
2020use SimpleSAML \Error \Exception ;
21+ use SimpleSAML \Module \oidc \Bridges \SspBridge ;
2122use SimpleSAML \Module \oidc \Forms \Controls \CsrfProtection ;
2223use SimpleSAML \Module \oidc \ModuleConfig ;
2324
2425class 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments