Skip to content

Commit 24d157e

Browse files
committed
Add controllers & tests
1 parent 1188390 commit 24d157e

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

lib/Controller/AuthProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function main(Request $request): Response
183183
});
184184
} else {
185185
if ($state['FIDO2WantsRegister']) {
186-
$response = new RedirectResponse(Module::getModuleURL('webauthn.php/webauthn?StateId=' . urlencode($stateId)));
186+
$response = new RedirectResponse(Module::getModuleURL('webauthn/webauthn.php?StateId=' . urlencode($stateId)));
187187
} else {
188188
$response = new RunnableResponse([Auth\ProcessingChain::class, 'resumeProcessing'], [$state]);
189189
}

lib/Controller/WebAuthn.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ public function main(Request $request): Template
9797
/** @var array $state */
9898
$state = $this->authState::loadState($stateId, 'webauthn:request');
9999

100+
$templateFile = $state['UseInflowRegistration'] ? 'webauthn:webauthn.tpl.php' : 'webauthn:authentication.tpl.php';
101+
100102
// Make, populate and layout consent form
101-
$t = new Template($this->config, 'webauthn:authentication.tpl.php');
103+
$t = new Template($this->config, $templateFile);
102104
$t->data['UserID'] = $state['FIDO2Username'];
103105
$t->data['FIDO2Tokens'] = $state['FIDO2Tokens'];
104106

@@ -143,11 +145,11 @@ public function main(Request $request): Template
143145

144146
$t->data['FIDO2AuthSuccessful'] = $state['FIDO2AuthSuccessful'];
145147
if (
146-
count($state['FIDO2Tokens']) == 0 ||
148+
count($state['FIDO2Tokens']) === 0 ||
147149
($state['FIDO2WantsRegister'] === true && $state['FIDO2AuthSuccessful'] !== false)
148150
) {
149-
$t->data['regURL'] = Module::getModuleURL('webauthn.php/regprocess?StateId=' . urlencode($stateId));
150-
$t->data['delURL'] = Module::getModuleURL('webauthn.php/managetoken?StateId=' . urlencode($stateId));
151+
$t->data['regURL'] = Module::getModuleURL('webauthn/regprocess.php?StateId=' . urlencode($stateId));
152+
$t->data['delURL'] = Module::getModuleURL('webauthn/managetoken.php?StateId=' . urlencode($stateId));
151153
}
152154

153155
$t->data['authForm'] = "";

tests/lib/Controller/WebAuthnTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function testWebAuthn(): void
7979
public static function loadState($id, $stage, $allowMissing = false)
8080
{
8181
return [
82+
'UseInflowRegistration' => true,
8283
'FIDO2Displayname' => 'Donald Duck',
8384
'FIDO2Username' => 'dduck',
8485
'FIDO2Scope' => 'Ducktown',

0 commit comments

Comments
 (0)