You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-19Lines changed: 21 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -84,25 +84,27 @@ TODO the descriptions
84
84
### Registration Process Flow
85
85
86
86
1. User navigates to a 2nd factor authentication page in your application.
87
+
87
88
... TODO add the rest of the registration process flow ...
88
89
89
90
### Authentication Process Flow
90
91
91
92
1. User navigates to their login page as they usually would, submits username and password.
92
-
2. Server received POST request authentication data, normal username + password validation occurs
93
-
3. On successful authentication, the application checks 2nd factor authentication is required. We're going to presume it is, otherwise the user would just be logged in at this stage.
94
-
4. Application gets the user's registered signatures from the application datastore: `$registrations`.
95
-
5. Application makes a `$U2F->makeAuthentication($registrations)` call, the method returns an array of `SignRequest` objects: `$signRequest`.
96
-
6. Application JSON encodes the array and passes the data to the view
97
-
7. When the browser loads the page the JavaScript fires the `u2f.sign(sign_requests, function(data){ // Callback logic })` function
98
-
8. The view will use JavaScript / Browser to poll the host machine's ports for a FIDO U2F device
99
-
9. Once the HID has been found the JavaScript / Browser will send the sign request with data.
100
-
10. The HID will prompt the user to authorise the sign request
101
-
11. On success the HID returns authentication data
102
-
12. The JavaScript receives the HID's returned data and passes it to the server
103
-
13. The application takes the returned data passes it to the `$U2F->authenticate($signRequest, $registrations, $incomingData)` method
104
-
14. If the method returns a registration and doesn't throw an Exception, authentication is complete.
105
-
15. Set the user's session, inform the user of the success, and redirect them.
93
+
1. Server received POST request authentication data, normal username + password validation occurs
94
+
1. On successful authentication, the application checks 2nd factor authentication is required. We're going to presume it is, otherwise the user would just be logged in at this stage.
95
+
1. Application gets the user's registered signatures from the application datastore: `$registrations`.
96
+
1. Application gets its ID, usually the domain the application is accessible from: `$appId`
97
+
1. Application makes a `U2F::makeAuthentication($registrations, $appId)` call, the method returns an array of `SignRequest` objects: `$authenticationRequest`.
98
+
1. Application JSON encodes the array and passes the data to the view
99
+
1. When the browser loads the page the JavaScript fires the `u2f.sign(authenticationRequest, function(data){ // Callback logic })` function
100
+
1. The view will use JavaScript / Browser to poll the host machine's ports for a FIDO U2F device
101
+
1. Once the HID has been found the JavaScript / Browser will send the sign request with data.
102
+
1. The HID will prompt the user to authorise the sign request
103
+
1. On success the HID returns authentication data
104
+
1. The JavaScript receives the HID's returned data and passes it to the server
105
+
1. The application takes the returned data passes it to the `U2F::authenticate($authenticationRequest, $registrations, $authenticationResponse)` method
106
+
1. If the method returns a registration and doesn't throw an Exception, authentication is complete.
107
+
1. Set the user's session, inform the user of the success, and redirect them.
106
108
107
109
## Example Code
108
110
@@ -137,7 +139,7 @@ You'll only ever need to use this method call once per installation and only in
137
139
<?php
138
140
139
141
require('vendor/autoload.php');
140
-
use Samyoul\U2F;
142
+
use Samyoul\U2F\U2FServer\U2FServer as U2F;
141
143
142
144
var_dump(U2F::checkOpenSSLVersion());
143
145
```
@@ -155,7 +157,7 @@ We assume that user has successfully authenticated and wishes to register.
155
157
<?php
156
158
157
159
require('vendor/autoload.php');
158
-
use Samyoul\U2F;
160
+
use Samyoul\U2F\U2FServer\U2FServer as U2F;
159
161
160
162
session_start();
161
163
@@ -237,7 +239,7 @@ This is the last stage of registration. Validate the registration response data
237
239
<?php
238
240
239
241
require('vendor/autoload.php');
240
-
use Samyoul\U2F;
242
+
use Samyoul\U2F\U2FServer\U2FServer as U2F;
241
243
242
244
session_start();
243
245
@@ -279,7 +281,7 @@ We assume that user has successfully authenticated and has previously registered
279
281
<?php
280
282
281
283
require('vendor/autoload.php');
282
-
use Samyoul\U2F;
284
+
use Samyoul\U2F\U2FServer\U2FServer as U2F;
283
285
284
286
session_start();
285
287
@@ -364,7 +366,7 @@ This is the last stage of authentication. Validate the authentication response d
0 commit comments