File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ public function retrieveByCredentials(array $credentials): ?User
5050 return $ this ->retrieveById ($ webauthnKey ->user_id );
5151 } catch (ModelNotFoundException $ e ) {
5252 // No result
53+ return null ;
5354 }
5455 }
5556
Original file line number Diff line number Diff line change @@ -142,4 +142,29 @@ public function it_retrieve_user_new_format()
142142 $ this ->assertNotNull ($ result );
143143 $ this ->assertEquals ($ user ->id , $ result ->id );
144144 }
145+
146+ /**
147+ * @test
148+ */
149+ public function it_does_not_fail_when_retrieving_user ()
150+ {
151+ Webauthn::shouldReceive ('validateAssertion ' )->andReturn (true );
152+ Webauthn::shouldReceive ('model ' )->andReturn (WebauthnKey::class);
153+
154+ $ provider = new EloquentWebAuthnProvider (
155+ app ('config ' ),
156+ app (CredentialAssertionValidator::class),
157+ app (Hasher::class),
158+ User::class,
159+ );
160+
161+ $ result = $ provider ->retrieveByCredentials ([
162+ 'id ' => Base64UrlSafe::encode ('id ' ),
163+ 'rawId ' => 'rawId ' ,
164+ 'type ' => 'public-key ' ,
165+ 'response ' => 'response ' ,
166+ ]);
167+
168+ $ this ->assertNull ($ result );
169+ }
145170}
You can’t perform that action at this time.
0 commit comments