File tree 2 files changed +26
-0
lines changed
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
50
50
return $ this ->retrieveById ($ webauthnKey ->user_id );
51
51
} catch (ModelNotFoundException $ e ) {
52
52
// No result
53
+ return null ;
53
54
}
54
55
}
55
56
Original file line number Diff line number Diff line change @@ -142,4 +142,29 @@ public function it_retrieve_user_new_format()
142
142
$ this ->assertNotNull ($ result );
143
143
$ this ->assertEquals ($ user ->id , $ result ->id );
144
144
}
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
+ }
145
170
}
You can’t perform that action at this time.
0 commit comments