Skip to content

Commit 1908048

Browse files
authored
Exception error message if misconfigured password authsource, instead of: (#79)
TypeError: get_class(): Argument #1 ($object) must be of type object, null given
1 parent 04738b7 commit 1908048

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Controller/PushbackUserPass.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ public function main(Request $request): Response
8585

8686
$authsources = Configuration::getConfig('authsources.php')->toArray();
8787
$authsourceString = $state['pushbackAuthsource'];
88-
$classname = get_class(Auth\Source::getById($authsourceString));
88+
$authsourceClass = Auth\Source::getById($authsourceString);
89+
if (is_null($authsourceClass)) {
90+
throw new Exception("password authsource not found");
91+
}
92+
$classname = get_class($authsourceClass);
8993
class_alias($classname, '\SimpleSAML\Module\webauthn\Auth\Source\AuthSourceOverloader');
9094
$overrideSource = new class (
9195
['AuthId' => $authsourceString],

0 commit comments

Comments
 (0)