Skip to content

Commit 8a3c23c

Browse files
authored
Step Up Updates (#123)
* Additions for step up
1 parent a40c98f commit 8a3c23c

File tree

4 files changed

+165
-1
lines changed

4 files changed

+165
-1
lines changed

src/guide/admin-console/applications.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ You should now be able to call `https://v4.passwordless.dev/signin/generate-toke
5050
Magic Links provides you with the ability to email your users a link that will redirect them to your application without having to configure your own email provider. This feature can be enabled by going to the **Settings** page, scrolling to the **Magic Links** section, checking the box, and clicking Save.
5151

5252
You should now be able to call `https://v4.passwordless.dev/magic-links/send` to send Magic Link emails to your users. For more information, please refer to the [documentation](../api.md#magic-links-send).
53+
54+
### Authentication Configurations
55+
56+
Authentication Configurations allow you to fine tune the tokens being used through the `signin` or `stepup` client methods. The two default purposes are `sign-in` and `step-up`. You can configure the TTL on each of them and change the User Verification requirement. However, they cannot be deleted.
57+
58+
You can create additional configurations to suit your needs and pass through the purposes through the `stepup()` client method.

src/guide/api.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,135 @@ If successful, the `/magic-links/send` endpoint will return an HTTP 204 (No Cont
402402

403403
If Magic Links has not been enabled, the `/magic-links/send` endpoint will return an HTTP 403 (Unauthorized) [status code](#status-codes) along with a message about enabling the Magic Links feature.
404404

405+
## `/auth-configs/list`
406+
407+
### Request
408+
409+
`GET` requests made to the `/auth-configs/list` endpoint will return a `.json` object containing a list of authentication configurations that can be used by the application. It can be filtered to one specific configuration by passing the purpose name as a query parameter.
410+
411+
```http request
412+
GET https://v4.passwwordless.dev/auth-configs/list HTTP/1.1
413+
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
414+
```
415+
416+
```http request
417+
GET https://v4.passwwordless.dev/auth-configs/list?purpose=step-up HTTP/1.1
418+
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
419+
```
420+
421+
For more information about Authentication Configurations, please see the [concepts page](concepts.md#authentication-configurations).
422+
423+
### Response
424+
425+
If successful, the `/auth-configs/list` endpoint will return a `.json` object containing a list of authentication configurations:
426+
427+
```json
428+
{
429+
"configurations": [
430+
{
431+
"purpose": "sign-in",
432+
"timeToLive": 120,
433+
"userVerificationRequirement": "preferred",
434+
"createdBy": "System",
435+
"createdOn": null,
436+
"editedBy": null,
437+
"editedOn": null,
438+
"lastUsedOn": null
439+
},
440+
{
441+
"purpose": "step-up",
442+
"timeToLive": 180,
443+
"userVerificationRequirement": "required",
444+
"createdBy": "System",
445+
"createdOn": null,
446+
"editedBy": null,
447+
"editedOn": null,
448+
"lastUsedOn": null
449+
}
450+
]
451+
}
452+
```
453+
454+
## `/auth-configs/add`
455+
456+
### Request
457+
458+
`POST` requests to `/auth-configs/add` will create an authentication configuration for the authentication process. There are some restrictions on the request object.
459+
460+
- `purpose`: A-z, 0-9, -, and \_ are the allowed characters. Max length of purpose is 255 characters.
461+
- `timeToLive`: Positive time span value (hh:mm:ss)
462+
- `userVerificationRequirement`: `preferred`, `required`, `discouraged`
463+
- `performedBy`: user identifier to track changes to the configuration
464+
465+
```http request
466+
GET https://v4.passwwordless.dev/auth-configs/add HTTP/1.1
467+
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
468+
Content-Type: application/json
469+
470+
{
471+
"purpose": "access-secrets-purpose", // identifying string give context to the specific authentication
472+
"timeToLive": "00:03:00", // timespan the token is valid for
473+
"userVerificationRequirement": "preferred" // requirement for if the user has to verify they're allowed to use an authenticator
474+
"performedBy": "user_123" // user identifier to track changes to the configuration
475+
}
476+
```
477+
478+
### Response
479+
480+
If successful, the `/auth-configs/add` endpoint will return an HTTP 201 (Created) [status code](#status-codes).
481+
If unsuccessful, the `/auth-configs/add` endpoint will return an HTTP 400 (Bad Request) [status code](#status-codes) with a [problem details](errors/#problem-details) body.
482+
483+
## `/auth-configs/`
484+
485+
### Request
486+
487+
`POST` requests to `/auth-configs` will edit an authentication configuration for the authentication process. There are some restrictions on the request object.
488+
489+
- `purpose`: Must be an existing purpose (If a new purpose is passed here, a 404 will be returned)
490+
- `timeToLive`: Positive time span value (hh:mm:ss)
491+
- `userVerificationRequirement`: `preferred`, `required`, `discouraged`
492+
- `performedBy`: user identifier to track changes to the configuration
493+
494+
```http request
495+
GET https://v4.passwwordless.dev/auth-configs HTTP/1.1
496+
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
497+
Content-Type: application/json
498+
499+
{
500+
"purpose": "access-secrets-purpose", // existing purpose
501+
"timeToLive": "00:03:00", // timespan the token is valid for
502+
"userVerificationRequirement": "preferred" // requirement for if the user has to verify they're allowed to use an authenticator
503+
"performedBy": "user_123" // user identifier to track changes to the configuration
504+
}
505+
```
506+
507+
### Response
508+
509+
If successful, the `/auth-configs` endpoint will return an HTTP 204 (No Content) [status code](#status-codes).
510+
If an unknown purpose is passed through, the `/auth-configs` endpoint will return an HTTP 404 (Not Found) [status code](#status-codes).
511+
512+
## `/auth-configs/delete`
513+
514+
### Request
515+
516+
`POST` requests made to the `/auth-configs/delete` endpoint delete a specific authentication configuration, as specified by a `purpose`.
517+
518+
```http request
519+
GET https://v4.passwwordless.dev/auth-configs/add HTTP/1.1
520+
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
521+
Content-Type: application/json
522+
523+
{
524+
"purpose": "access-secrets-purpose", // existing purpose
525+
"performedBy": "user_123" // user identifier to track changes to the configuration
526+
}
527+
```
528+
529+
### Response
530+
531+
If successful, the `/auth-configs/delete` endpoint will return an HTTP 204 (No Content) [status code](#status-codes).
532+
If an unknown purpose is passed through, the `/auth-configs/delete` endpoint will return an HTTP 404 (Not Found) [status code](#status-codes).
533+
405534
### Status codes
406535

407536
The API returns HTTP Status codes for each request.

src/guide/concepts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ While WebAuthn is very secure, attestation enhances the security of the WebAuthn
113113

114114
The relying party can use the attestation information to make informed decisions about whether to trust the authenticator and to assess the level of security provided by the user's device. It's important to note that while attestation enhances security, it is not mandatory for the basic operation of WebAuthn. WebAuthn can still work without attestation, but its use is recommended for stronger security practices.
115115

116+
### Authentication Configurations
117+
118+
Authentication configurations allow you to configure your authentication token used in the `signin()` and `stepup()` client methods. Each method passes parameters into the authenticator accessed by the browser. Authentication Configurations allow for the Time to Live of the authentication token and the User Verification Requirement setting to be set for the given authentication workflow.
119+
120+
There are two default Authentication Configurations for each application, `step-up` and `sign-in`. They are used in their respective client methods as the `purpose` of the authentication. They can be edited, and if deleted, they will revert back to their default settings. Authentication Configurations can be accessed via the [API](./api.md#auth-configs) or [Admin Console](./admin-console/applications.md#authentication-configurations).
121+
116122
## More terms
117123

118124
### Relying party

src/guide/frontend/javascript.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const { token, error } = await p.siginWithId(123);
162162
// plain object
163163
const signinResponse = await p.signinWithId(123);
164164
console.log(signinResponse.token); // "verify_xxyyzz"
165-
console.log(signinResponse.error); // undefined or a problem details object
165+
console.error(response.error); // undefined or a problem details object
166166
```
167167

168168
If the signin was successful, the `token` has a string value `"verify_xxyyzz"`. If the sign-in failed, the `error` property contains the [problem details](../errors.md#problem-details).
@@ -193,3 +193,26 @@ Call the static async `.isAutofillSupported()` method to check if the end-user's
193193
if (await Passwordless.isAutofillSupported()) {
194194
}
195195
```
196+
197+
## .stepup()
198+
199+
`.stepup()` works similar to the `.signin()` method except it allows for a specific purpose to be passed through. These purposes are set via the API ([API](../api.md#authentication)/OpenAPI) or through the application's authentication configuration setting in the [Admin Console](../admin-console/applications.md#authentication-configurations).
200+
201+
If the authentication was successful, the `token` has a string value `"verify_xxyyzz"`. This token will have a `Purpose` property of `step-up` by default, whatever was passed in through the `StepUpRequest`. If the authentication failed, the `error` property contains the [problem details](../errors.md#problem-details).
202+
203+
```js
204+
const stepUpRequest = {
205+
signinMethod: {
206+
userId: 123 // you could also use alias as the signinMethod as well.
207+
},
208+
purpose: 'step-up'
209+
};
210+
211+
// destructured
212+
const { token, error } = await p.stepup(stepUpRequest);
213+
214+
// plain object
215+
const response = await p.stepup(stepUpRequest);
216+
console.log(response.token); // verify_xxyyzz
217+
console.error(response.error); // undefined or a problem details object
218+
```

0 commit comments

Comments
 (0)