Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e420ba518 | ||
|
|
73502cea4e | ||
|
|
0b381551e0 | ||
|
|
b0aa1974de | ||
|
|
3291c57a3a | ||
|
|
2ed7cdeff3 |
13
README.md
13
README.md
@@ -258,6 +258,8 @@ const webAuthn = new WebAuthn({}, {
|
|||||||
|
|
||||||
Attestation is the _ceremony_ to create WebAuthn Credentials. To create an Attestable Response that the user device can understand, use the `AttestationRequest::toCreate()` form request.
|
Attestation is the _ceremony_ to create WebAuthn Credentials. To create an Attestable Response that the user device can understand, use the `AttestationRequest::toCreate()` form request.
|
||||||
|
|
||||||
|
For example, we can create our own `AttestationController` to create it.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
// app\Http\Controllers\WebAuthn\AttestationController.php
|
// app\Http\Controllers\WebAuthn\AttestationController.php
|
||||||
use Laragear\WebAuthn\Http\Requests\AttestationRequest;
|
use Laragear\WebAuthn\Http\Requests\AttestationRequest;
|
||||||
@@ -354,6 +356,8 @@ The Assertion procedure also follows a two-step procedure: the user will input i
|
|||||||
|
|
||||||
First, use the `AssertionRequest::toVerify()` form request. It will automatically create an assertion for the user that matches the credentials, or a blank one in case you're using [userless login](#userlessone-touchtypeless-login). Otherwise, you may set stricter validation rules to always ask for credentials.
|
First, use the `AssertionRequest::toVerify()` form request. It will automatically create an assertion for the user that matches the credentials, or a blank one in case you're using [userless login](#userlessone-touchtypeless-login). Otherwise, you may set stricter validation rules to always ask for credentials.
|
||||||
|
|
||||||
|
For example, we can use our own `AssertionController` to handle it.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
// app\Http\Controllers\WebAuthn\AssertionController.php
|
// app\Http\Controllers\WebAuthn\AssertionController.php
|
||||||
use Laragear\WebAuthn\Http\Requests\AssertionRequest;
|
use Laragear\WebAuthn\Http\Requests\AssertionRequest;
|
||||||
@@ -573,10 +577,17 @@ return [
|
|||||||
The _Relying Party_ is just a way to uniquely identify your application in the user device:
|
The _Relying Party_ is just a way to uniquely identify your application in the user device:
|
||||||
|
|
||||||
* `name`: The name of the application. Defaults to the application name.
|
* `name`: The name of the application. Defaults to the application name.
|
||||||
* `id`: An unique ID the application, like the site domain. If `null`, the device may fill it internally, usually as the full domain.
|
* `id`: An unique ID the application, like the site URL. If `null`, the device _may_ fill it internally, usually as the full domain.
|
||||||
|
|
||||||
> WebAuthn authentication only work on the top domain it was registered.
|
> WebAuthn authentication only work on the top domain it was registered.
|
||||||
|
|
||||||
|
Instead of modifying the config file, you should use the environment variables to set the name and ID for WebAuthn.
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
WEBAUTHN_NAME=SecureBank
|
||||||
|
WEBAUTHN_ID=https://auth.securebank.com
|
||||||
|
```
|
||||||
|
|
||||||
### Challenge configuration
|
### Challenge configuration
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|||||||
@@ -156,7 +156,9 @@ class WebAuthn {
|
|||||||
* @returns {Promise<Response>}
|
* @returns {Promise<Response>}
|
||||||
*/
|
*/
|
||||||
#fetch(data, route, headers = {}) {
|
#fetch(data, route, headers = {}) {
|
||||||
return fetch(route, {
|
const url = new URL(route, window.location.origin).href;
|
||||||
|
|
||||||
|
return fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
credentials: this.#includeCredentials ? "include" : "same-origin",
|
credentials: this.#includeCredentials ? "include" : "same-origin",
|
||||||
redirect: "error",
|
redirect: "error",
|
||||||
@@ -313,6 +315,7 @@ class WebAuthn {
|
|||||||
const publicKeyCredential = this.#parseOutgoingCredentials(credentials);
|
const publicKeyCredential = this.#parseOutgoingCredentials(credentials);
|
||||||
|
|
||||||
Object.assign(publicKeyCredential, response);
|
Object.assign(publicKeyCredential, response);
|
||||||
|
Object.assign(publicKeyCredential, request);
|
||||||
|
|
||||||
return await this.#fetch(publicKeyCredential, this.#routes.register).then(WebAuthn.#handleResponse);
|
return await this.#fetch(publicKeyCredential, this.#routes.register).then(WebAuthn.#handleResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user