auth0-actions 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +284 -0
- package/package.json +25 -5
- package/index.ts +0 -842
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 CloudNimble
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# auth0-actions
|
|
2
|
+
|
|
3
|
+
> **DEPRECATION NOTICE**: This package is now deprecated in favor of the official [@auth0/actions](https://www.npmjs.com/package/@auth0/actions) package from Auth0. Please migrate to the official package for better support and comprehensive coverage.
|
|
4
|
+
|
|
5
|
+
Type definitions and utilities for building Auth0 Actions.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install auth0-actions
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
This package provides TypeScript type definitions for Auth0 Actions, focusing on:
|
|
16
|
+
- **Credentials Exchange** actions
|
|
17
|
+
- **Post-Login** actions
|
|
18
|
+
|
|
19
|
+
The types are designed to help you build type-safe Auth0 Actions with proper intellisense support in your IDE.
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { PostLoginEvent, PostLoginApi } from 'auth0-actions';
|
|
25
|
+
|
|
26
|
+
// Define your custom types
|
|
27
|
+
interface MySecrets {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface MyClientMetadata {
|
|
32
|
+
clientType: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface MyAppMetadata {
|
|
36
|
+
roles: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface MyUserMetadata {
|
|
40
|
+
preferences: {
|
|
41
|
+
theme: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Your Post-Login action
|
|
46
|
+
export async function onExecutePostLogin(
|
|
47
|
+
event: PostLoginEvent<MySecrets, MyClientMetadata, MyAppMetadata, MyUserMetadata>,
|
|
48
|
+
api: PostLoginApi
|
|
49
|
+
) {
|
|
50
|
+
const apiKey = event.secrets?.apiKey;
|
|
51
|
+
const userRoles = event.user?.app_metadata.roles;
|
|
52
|
+
|
|
53
|
+
if (!userRoles?.includes('admin')) {
|
|
54
|
+
api.access.deny('User does not have admin role');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
api.accessToken.setCustomClaim('https://my-app.com/roles', userRoles);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Credentials Exchange Example
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { CredentialsExchangeEvent, CredentialsExchangeApi, CredentialsExchangeRequestBody } from 'auth0-actions';
|
|
65
|
+
|
|
66
|
+
interface MySecrets {
|
|
67
|
+
clientSecret: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface MyClientMetadata {
|
|
71
|
+
tier: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface MyRequestBody extends CredentialsExchangeRequestBody {
|
|
75
|
+
custom_param?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function onExecuteCredentialsExchange(
|
|
79
|
+
event: CredentialsExchangeEvent<MySecrets, MyClientMetadata, MyRequestBody>,
|
|
80
|
+
api: CredentialsExchangeApi
|
|
81
|
+
) {
|
|
82
|
+
const tier = event.client?.metadata.tier;
|
|
83
|
+
|
|
84
|
+
if (tier === 'free') {
|
|
85
|
+
api.access.deny('Free tier not allowed for this resource');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
api.accessToken.setCustomClaim('https://my-app.com/tier', tier);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Limitations
|
|
93
|
+
|
|
94
|
+
This package provides a simplified implementation focused on the most common Auth0 Actions use cases. It has several limitations:
|
|
95
|
+
|
|
96
|
+
1. **Limited Action Types**: Only covers Credentials Exchange and Post-Login actions
|
|
97
|
+
2. **No Versioning**: Does not support multiple API versions
|
|
98
|
+
3. **Incomplete Coverage**: Missing several action types available in Auth0
|
|
99
|
+
4. **Generic Approach**: Uses TypeScript generics instead of specific inline types
|
|
100
|
+
|
|
101
|
+
## Migration to Official Package
|
|
102
|
+
|
|
103
|
+
Auth0 now provides an official [@auth0/actions](https://www.npmjs.com/package/@auth0/actions) package that is:
|
|
104
|
+
- ✅ More comprehensive (12+ action types)
|
|
105
|
+
- ✅ Properly versioned (v1, v2, v3 for different APIs)
|
|
106
|
+
- ✅ Better typed with discriminated unions
|
|
107
|
+
- ✅ Officially maintained by Auth0
|
|
108
|
+
- ✅ Matches Auth0's actual API exactly
|
|
109
|
+
|
|
110
|
+
### Upgrade Guide
|
|
111
|
+
|
|
112
|
+
#### Step 1: Install the Official Package
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm uninstall auth0-actions
|
|
116
|
+
npm install @auth0/actions
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Step 2: Update Your Imports
|
|
120
|
+
|
|
121
|
+
**Before (this package):**
|
|
122
|
+
```typescript
|
|
123
|
+
import { PostLoginEvent, PostLoginApi } from 'auth0-actions';
|
|
124
|
+
|
|
125
|
+
export async function onExecutePostLogin(
|
|
126
|
+
event: PostLoginEvent<MySecrets, MyClientMetadata, MyAppMetadata, MyUserMetadata>,
|
|
127
|
+
api: PostLoginApi
|
|
128
|
+
) {
|
|
129
|
+
// Your code
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**After (official package):**
|
|
134
|
+
```typescript
|
|
135
|
+
import type {
|
|
136
|
+
PostLoginAction
|
|
137
|
+
} from '@auth0/actions/post-login/v3';
|
|
138
|
+
|
|
139
|
+
export const onExecutePostLogin: PostLoginAction = async (event, api) => {
|
|
140
|
+
// Your code - the types are inferred automatically
|
|
141
|
+
// No need for generic type parameters
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Step 3: Property Name Changes
|
|
146
|
+
|
|
147
|
+
The official package uses consistent `snake_case` for all properties to match Auth0's API:
|
|
148
|
+
|
|
149
|
+
| This Package (deprecated) | Official Package |
|
|
150
|
+
|--------------------------|------------------|
|
|
151
|
+
| `event.client?.clientId` | `event.client.client_id` |
|
|
152
|
+
| `event.user?.user_metadata` | `event.user.user_metadata` ✓ (same) |
|
|
153
|
+
| Generic types | Inline types with specific versions |
|
|
154
|
+
|
|
155
|
+
#### Step 4: Handle Secrets and Configuration
|
|
156
|
+
|
|
157
|
+
**Before:**
|
|
158
|
+
```typescript
|
|
159
|
+
interface MySecrets {
|
|
160
|
+
apiKey: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Then used as generic parameter
|
|
164
|
+
PostLoginEvent<MySecrets, ...>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**After:**
|
|
168
|
+
```typescript
|
|
169
|
+
// Secrets are automatically typed
|
|
170
|
+
const apiKey = event.secrets.API_KEY; // string
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
For better type safety with secrets, you can augment the official types:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import type { PostLoginAction } from '@auth0/actions/post-login/v3';
|
|
177
|
+
|
|
178
|
+
// Augment the Secrets interface
|
|
179
|
+
declare module '@auth0/actions/post-login/v3' {
|
|
180
|
+
interface Secrets {
|
|
181
|
+
API_KEY: string;
|
|
182
|
+
DATABASE_URL: string;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const onExecutePostLogin: PostLoginAction = async (event, api) => {
|
|
187
|
+
const apiKey = event.secrets.API_KEY; // Now typed as string
|
|
188
|
+
};
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Step 5: Action Type Mapping
|
|
192
|
+
|
|
193
|
+
| This Package | Official Package |
|
|
194
|
+
|-------------|------------------|
|
|
195
|
+
| `CredentialsExchangeEvent` | `@auth0/actions/credentials-exchange/v2` |
|
|
196
|
+
| `PostLoginEvent` | `@auth0/actions/post-login/v3` |
|
|
197
|
+
| Not available | `@auth0/actions/post-user-registration/v2` |
|
|
198
|
+
| Not available | `@auth0/actions/pre-user-registration/v2` |
|
|
199
|
+
| Not available | `@auth0/actions/post-change-password/v2` |
|
|
200
|
+
| And more... | See [official docs](https://auth0.com/docs/customize/actions) |
|
|
201
|
+
|
|
202
|
+
### Complete Migration Example
|
|
203
|
+
|
|
204
|
+
**Before (this package):**
|
|
205
|
+
```typescript
|
|
206
|
+
import { PostLoginEvent, PostLoginApi } from 'auth0-actions';
|
|
207
|
+
|
|
208
|
+
interface Secrets {
|
|
209
|
+
AUTH_SECRET: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export async function onExecutePostLogin(
|
|
213
|
+
event: PostLoginEvent<Secrets, any, any, any>,
|
|
214
|
+
api: PostLoginApi
|
|
215
|
+
) {
|
|
216
|
+
const secret = event.secrets?.AUTH_SECRET;
|
|
217
|
+
api.accessToken.setCustomClaim('role', event.user?.app_metadata.role);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**After (official package):**
|
|
222
|
+
```typescript
|
|
223
|
+
import type { PostLoginAction } from '@auth0/actions/post-login/v3';
|
|
224
|
+
|
|
225
|
+
declare module '@auth0/actions/post-login/v3' {
|
|
226
|
+
interface Secrets {
|
|
227
|
+
AUTH_SECRET: string;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export const onExecutePostLogin: PostLoginAction = async (event, api) => {
|
|
232
|
+
const secret = event.secrets.AUTH_SECRET;
|
|
233
|
+
api.accessToken.setCustomClaim('role', event.user.app_metadata.role);
|
|
234
|
+
};
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Why Migrate?
|
|
238
|
+
|
|
239
|
+
1. **Official Support**: Maintained directly by Auth0
|
|
240
|
+
2. **Complete Coverage**: All action types, not just 2
|
|
241
|
+
3. **API Versioning**: Target specific API versions (v1, v2, v3)
|
|
242
|
+
4. **Better Types**: More accurate with discriminated unions and specific error codes
|
|
243
|
+
5. **Future-Proof**: Gets updates when Auth0 adds new features
|
|
244
|
+
6. **Better Documentation**: Integrated with Auth0's official documentation
|
|
245
|
+
|
|
246
|
+
## Resources
|
|
247
|
+
|
|
248
|
+
- [Official @auth0/actions Package](https://www.npmjs.com/package/@auth0/actions)
|
|
249
|
+
- [Auth0 Actions Documentation](https://auth0.com/docs/customize/actions)
|
|
250
|
+
- [Auth0 Actions Triggers](https://auth0.com/docs/customize/actions/triggers)
|
|
251
|
+
- [Actions Marketplace](https://marketplace.auth0.com/features/actions)
|
|
252
|
+
|
|
253
|
+
## Legacy API Reference
|
|
254
|
+
|
|
255
|
+
For those still using this package, basic API reference:
|
|
256
|
+
|
|
257
|
+
### Event Interfaces
|
|
258
|
+
- `PostLoginEvent<TSecret, TClientMetadata, TAppMetadata, TUserMetadata>`
|
|
259
|
+
- `CredentialsExchangeEvent<TSecret, TClientMetadata, TRequest>`
|
|
260
|
+
|
|
261
|
+
### API Interfaces
|
|
262
|
+
- `PostLoginApi` - Main API for post-login actions
|
|
263
|
+
- `CredentialsExchangeApi` - Main API for credentials exchange
|
|
264
|
+
|
|
265
|
+
### Managers
|
|
266
|
+
- `AccessTokenManager` - Modify access token
|
|
267
|
+
- `IdTokenManager` - Modify ID token
|
|
268
|
+
- `CacheManager` - Store/retrieve cached data
|
|
269
|
+
- `UserManager` - Update user metadata
|
|
270
|
+
- `MultifactorManager` - Configure MFA
|
|
271
|
+
- `RedirectManager` - Handle redirects
|
|
272
|
+
- `AuthenticationManager` - Record authentication methods
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
MIT
|
|
277
|
+
|
|
278
|
+
## Author
|
|
279
|
+
|
|
280
|
+
CloudNimble, Inc. - opensource@nimbleapps.cloud
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
**Again, please migrate to [@auth0/actions](https://www.npmjs.com/package/@auth0/actions) for the best experience.**
|
package/package.json
CHANGED
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-actions",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Type definitions and utilities for building Auth0 Actions.",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Type definitions and utilities for building Auth0 Actions. DEPRECATED: Use @auth0/actions instead.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"deprecated": "This package is deprecated. Please use @auth0/actions for official, comprehensive Auth0 Actions type definitions.",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
10
|
"build": "tsc --build",
|
|
10
|
-
"clean": "tsc --build --clean"
|
|
11
|
+
"clean": "tsc --build --clean",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [
|
|
13
15
|
"auth0",
|
|
14
|
-
"actions"
|
|
16
|
+
"actions",
|
|
17
|
+
"typescript",
|
|
18
|
+
"types",
|
|
19
|
+
"auth0-actions",
|
|
20
|
+
"deprecated"
|
|
15
21
|
],
|
|
16
|
-
"author": "CloudNimble, Inc. opensource@nimbleapps.cloud",
|
|
22
|
+
"author": "CloudNimble, Inc. <opensource@nimbleapps.cloud>",
|
|
17
23
|
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/CloudNimble/Auth0.Actions.git",
|
|
27
|
+
"directory": "src/Auth0.Actions.TypeScript"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/CloudNimble/Auth0.Actions#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/CloudNimble/Auth0.Actions/issues"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist/**/*",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
18
38
|
"dependencies": {
|
|
19
39
|
"auth0": "^4.3.1"
|
|
20
40
|
},
|
package/index.ts
DELETED
|
@@ -1,842 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region Events
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export interface CredentialsExchangeEvent<TSecret, TClientMetadata, TRequest extends CredentialsExchangeRequestBody> {
|
|
8
|
-
|
|
9
|
-
/** An object containing information describing the authorization granted to the user who is logging in. */
|
|
10
|
-
accessToken?: AccessToken;
|
|
11
|
-
|
|
12
|
-
/** */
|
|
13
|
-
client?: Client<TClientMetadata>;
|
|
14
|
-
|
|
15
|
-
/** */
|
|
16
|
-
request?: RequestBase<TRequest>;
|
|
17
|
-
|
|
18
|
-
/** */
|
|
19
|
-
resource_server?: ResourceServer;
|
|
20
|
-
|
|
21
|
-
/** */
|
|
22
|
-
secrets?: TSecret;
|
|
23
|
-
|
|
24
|
-
/** */
|
|
25
|
-
tenant?: Tenant;
|
|
26
|
-
|
|
27
|
-
/** */
|
|
28
|
-
transaction?: TransactionBase;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
export interface PostLoginEvent<TSecret, TClientMetadata, TAppMetadata, TUserMetadata> {
|
|
36
|
-
|
|
37
|
-
/** Details about authentication signals obtained during the login flow. */
|
|
38
|
-
authentication?: AuthenticationInfoWithRiskAssessment
|
|
39
|
-
|
|
40
|
-
/** An object containing information describing the authorization granted to the user who is logging in. */
|
|
41
|
-
authorization?: AuthorizationInfo;
|
|
42
|
-
|
|
43
|
-
/** */
|
|
44
|
-
client?: Client<TClientMetadata>;
|
|
45
|
-
|
|
46
|
-
/** */
|
|
47
|
-
configuration?: Configuration;
|
|
48
|
-
|
|
49
|
-
/** */
|
|
50
|
-
connection?: Connection;
|
|
51
|
-
|
|
52
|
-
/** */
|
|
53
|
-
organization?: Organization;
|
|
54
|
-
|
|
55
|
-
/** */
|
|
56
|
-
request?: Request<any>;
|
|
57
|
-
|
|
58
|
-
/** */
|
|
59
|
-
resource_server?: ResourceServer;
|
|
60
|
-
|
|
61
|
-
/** */
|
|
62
|
-
secrets?: TSecret;
|
|
63
|
-
|
|
64
|
-
/** */
|
|
65
|
-
stats?: Stats;
|
|
66
|
-
|
|
67
|
-
/** */
|
|
68
|
-
tenant?: Tenant;
|
|
69
|
-
|
|
70
|
-
/** */
|
|
71
|
-
transaction?: Transaction;
|
|
72
|
-
|
|
73
|
-
/** */
|
|
74
|
-
user?: UserBase<TAppMetadata, TUserMetadata>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
export interface AccessToken {
|
|
81
|
-
|
|
82
|
-
customClaims: any;
|
|
83
|
-
scope: string[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Details about authentication signals obtained during the login flow.
|
|
88
|
-
*/
|
|
89
|
-
export interface AuthenticationInfoWithRiskAssessment {
|
|
90
|
-
|
|
91
|
-
/** Contains the authentication methods a user has completed during their session. */
|
|
92
|
-
methods: AuthenticationMethod[];
|
|
93
|
-
|
|
94
|
-
riskAssessment?: RiskAssessmentSummary;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
export interface AuthenticationMethod {
|
|
101
|
-
/**
|
|
102
|
-
* The name of the first factor that was completed. Values include the following:
|
|
103
|
-
*/
|
|
104
|
-
name: AuthenticationMethods | string;
|
|
105
|
-
|
|
106
|
-
timestamp: string;
|
|
107
|
-
|
|
108
|
-
/* A specific MFA factor. Only present when name is set to 'mfa'. */
|
|
109
|
-
type: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
*/
|
|
115
|
-
export enum AuthenticationMethods {
|
|
116
|
-
|
|
117
|
-
/** A social or enterprise connection was used to authenticate the user as the first factor. */
|
|
118
|
-
federated = 'federated',
|
|
119
|
-
|
|
120
|
-
/** */
|
|
121
|
-
passkey = 'passkey',
|
|
122
|
-
|
|
123
|
-
/** A database connection was used to authenticate the user as the first factor. */
|
|
124
|
-
pwd = 'pwd',
|
|
125
|
-
|
|
126
|
-
/** A Passwordless SMS connection was used to authenticate the user as the first factor. */
|
|
127
|
-
sms = 'sms',
|
|
128
|
-
|
|
129
|
-
/** A Passwordless Email connection was used to authenticate the user as the first factor or verify email for password reset. */
|
|
130
|
-
email = 'email',
|
|
131
|
-
|
|
132
|
-
/** */
|
|
133
|
-
mfa = 'mfa',
|
|
134
|
-
|
|
135
|
-
/* "Used for internal testing. */
|
|
136
|
-
mock = 'mock'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
export interface AuthorizationInfo {
|
|
143
|
-
roles: string[];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
export interface Client<TMetadata> {
|
|
150
|
-
|
|
151
|
-
/** The client id of the application the user is logging in to. */
|
|
152
|
-
clientId: string;
|
|
153
|
-
|
|
154
|
-
/** An object for holding other application properties. */
|
|
155
|
-
metadata: TMetadata
|
|
156
|
-
|
|
157
|
-
/** The name of the application (as defined in the Dashboard). */
|
|
158
|
-
name: string;
|
|
159
|
-
|
|
160
|
-
/** */
|
|
161
|
-
strategy: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
*/
|
|
167
|
-
export interface Configuration {
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
*
|
|
173
|
-
*/
|
|
174
|
-
export interface Connection {
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* The connection's identifier
|
|
178
|
-
*/
|
|
179
|
-
id: string;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Metadata associated with the connection in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed.
|
|
183
|
-
*/
|
|
184
|
-
metadata: { [key: string]: any };
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* The name of the connection
|
|
188
|
-
*/
|
|
189
|
-
name: string;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* The type of the connection, related to the identity provider
|
|
193
|
-
*/
|
|
194
|
-
strategy: ConnectionStrategies;
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
*
|
|
200
|
-
*/
|
|
201
|
-
export enum ConnectionStrategies {
|
|
202
|
-
ad = 'ad',
|
|
203
|
-
adfs = 'adfs',
|
|
204
|
-
amazon = 'amazon',
|
|
205
|
-
apple = 'apple',
|
|
206
|
-
dropbox = 'dropbox',
|
|
207
|
-
bitbucket = 'bitbucket',
|
|
208
|
-
aol = 'aol',
|
|
209
|
-
auth0_oidc = 'auth0-oidc',
|
|
210
|
-
auth0 = 'auth0',
|
|
211
|
-
baidu = 'baidu',
|
|
212
|
-
bitly = 'bitly',
|
|
213
|
-
box = 'box',
|
|
214
|
-
custom = 'custom',
|
|
215
|
-
daccount = 'daccount',
|
|
216
|
-
dwolla = 'dwolla',
|
|
217
|
-
email = 'email',
|
|
218
|
-
evernote_sandbox = 'evernote-sandbox',
|
|
219
|
-
evernote = 'evernote',
|
|
220
|
-
exact = 'exact',
|
|
221
|
-
facebook = 'facebook',
|
|
222
|
-
fitbit = 'fitbit',
|
|
223
|
-
flickr = 'flickr',
|
|
224
|
-
github = 'github',
|
|
225
|
-
google_apps = 'google-apps',
|
|
226
|
-
google_oauth2 = 'google-oauth2',
|
|
227
|
-
instagram = 'instagram',
|
|
228
|
-
ip = 'ip',
|
|
229
|
-
line = 'line',
|
|
230
|
-
linkedin = 'linkedin',
|
|
231
|
-
miicard = 'miicard',
|
|
232
|
-
oauth1 = 'oauth1',
|
|
233
|
-
oauth2 = 'oauth2',
|
|
234
|
-
office365 = 'office365',
|
|
235
|
-
oidc = 'oidc',
|
|
236
|
-
okta = 'okta',
|
|
237
|
-
paypal = 'paypal',
|
|
238
|
-
paypal_sandbox = 'paypal-sandbox',
|
|
239
|
-
pingfederate = 'pingfederate',
|
|
240
|
-
planningcenter = 'planningcenter',
|
|
241
|
-
renren = 'renren',
|
|
242
|
-
salesforce_community = 'salesforce-community',
|
|
243
|
-
salesforce_sandbox = 'salesforce-sandbox',
|
|
244
|
-
salesforce = 'salesforce',
|
|
245
|
-
samlp = 'samlp',
|
|
246
|
-
sharepoint = 'sharepoint',
|
|
247
|
-
shopify = 'shopify',
|
|
248
|
-
sms = 'sms',
|
|
249
|
-
soundcloud = 'soundcloud',
|
|
250
|
-
thecity_sandbox = 'thecity-sandbox',
|
|
251
|
-
thecity = 'thecity',
|
|
252
|
-
thirtysevensignals = 'thirtysevensignals',
|
|
253
|
-
twitter = 'twitter',
|
|
254
|
-
untappd = 'untappd',
|
|
255
|
-
vkontakte = 'vkontakte',
|
|
256
|
-
waad = 'waad',
|
|
257
|
-
weibo = 'weibo',
|
|
258
|
-
windowslive = 'windowslive',
|
|
259
|
-
wordpress = 'wordpress',
|
|
260
|
-
yahoo = 'yahoo',
|
|
261
|
-
yammer = 'yammer',
|
|
262
|
-
yandex = 'yandex',
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
*
|
|
267
|
-
*/
|
|
268
|
-
export interface CredentialsExchangeRequestBody {
|
|
269
|
-
audience: string;
|
|
270
|
-
client_id: string;
|
|
271
|
-
client_secret: string;
|
|
272
|
-
grant_type: string;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
*
|
|
277
|
-
*/
|
|
278
|
-
export interface GeoIP {
|
|
279
|
-
cityName: string
|
|
280
|
-
continentCode: string
|
|
281
|
-
countryCode3: string
|
|
282
|
-
countryCode: string
|
|
283
|
-
countryName: string
|
|
284
|
-
latitude: number
|
|
285
|
-
longitude: number
|
|
286
|
-
subdivisionCode: string
|
|
287
|
-
subdivisionName: string
|
|
288
|
-
timeZone: string
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
*
|
|
293
|
-
*/
|
|
294
|
-
export interface Identity {
|
|
295
|
-
connection: string
|
|
296
|
-
isSocial: boolean
|
|
297
|
-
provider: string
|
|
298
|
-
userId: string
|
|
299
|
-
user_id: string
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
*
|
|
304
|
-
*/
|
|
305
|
-
export interface IPAddressDetails {
|
|
306
|
-
category: string;
|
|
307
|
-
ip: string;
|
|
308
|
-
matches: string;
|
|
309
|
-
source: string;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
*
|
|
314
|
-
*/
|
|
315
|
-
export interface NewDeviceDetails {
|
|
316
|
-
device: string;
|
|
317
|
-
useragent: string;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
*
|
|
322
|
-
*/
|
|
323
|
-
export interface Organization {
|
|
324
|
-
|
|
325
|
-
/* The friendly name of the Organization. */
|
|
326
|
-
display_name: string;
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* The Organization's identifier.
|
|
330
|
-
*/
|
|
331
|
-
id: string;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Metadata associated with the Organization.
|
|
335
|
-
*/
|
|
336
|
-
metadata: { [key: string]: any };
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* The name of the Organization.
|
|
340
|
-
*/
|
|
341
|
-
name: string;
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
*
|
|
347
|
-
*/
|
|
348
|
-
export interface Query {
|
|
349
|
-
audience: string
|
|
350
|
-
client_id: string
|
|
351
|
-
code_challenge: string
|
|
352
|
-
code_challenge_method: string
|
|
353
|
-
prompt: string
|
|
354
|
-
redirect_uri: string
|
|
355
|
-
response_mode: string
|
|
356
|
-
response_type: string
|
|
357
|
-
scope: string
|
|
358
|
-
state: string
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
*
|
|
363
|
-
*/
|
|
364
|
-
export interface Request<TBody> extends RequestBase<TBody> {
|
|
365
|
-
query: Query;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
*
|
|
370
|
-
*/
|
|
371
|
-
export interface RequestBase<TBody> {
|
|
372
|
-
body: TBody;
|
|
373
|
-
geoip: GeoIP;
|
|
374
|
-
hostname: string;
|
|
375
|
-
ip: string;
|
|
376
|
-
method: string;
|
|
377
|
-
user_agent: string;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
*
|
|
382
|
-
*/
|
|
383
|
-
export interface ResourceServer {
|
|
384
|
-
identifier: string
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export interface RiskAssessmentBase {
|
|
388
|
-
|
|
389
|
-
code: string;
|
|
390
|
-
|
|
391
|
-
confidence: string;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
*
|
|
396
|
-
*/
|
|
397
|
-
export interface RiskAssessmentSummary {
|
|
398
|
-
assessments: RiskAssessments;
|
|
399
|
-
confidence: "low" | "medium" | "high" | "neutral";
|
|
400
|
-
version: string;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
*
|
|
405
|
-
*/
|
|
406
|
-
export interface RiskAssessments {
|
|
407
|
-
|
|
408
|
-
ImpossibleTravel: RiskAssessmentBase;
|
|
409
|
-
|
|
410
|
-
NewDevice: RiskAssessmentWithDetails<NewDeviceDetails>
|
|
411
|
-
|
|
412
|
-
UntrustedIP: RiskAssessmentWithDetails<IPAddressDetails>
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
*
|
|
417
|
-
*/
|
|
418
|
-
export interface RiskAssessmentWithDetails<TDetails> {
|
|
419
|
-
|
|
420
|
-
details: TDetails;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
*
|
|
425
|
-
*/
|
|
426
|
-
export interface Stats {
|
|
427
|
-
logins_count: number
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
*
|
|
432
|
-
*/
|
|
433
|
-
export interface Tenant {
|
|
434
|
-
id: string
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
*
|
|
439
|
-
*/
|
|
440
|
-
export interface Transaction extends TransactionBase {
|
|
441
|
-
acr_values: any[]
|
|
442
|
-
linking_id?: string
|
|
443
|
-
locale: string
|
|
444
|
-
login_hint?: string
|
|
445
|
-
prompt: string[]
|
|
446
|
-
protocol?: TransactionProtocols
|
|
447
|
-
redirect_uri?: string
|
|
448
|
-
response_mode?: string
|
|
449
|
-
response_type?: string[]
|
|
450
|
-
state?: string
|
|
451
|
-
ui_locales: string[]
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
*
|
|
456
|
-
*/
|
|
457
|
-
export interface TransactionBase {
|
|
458
|
-
requested_scopes: string[]
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
*
|
|
463
|
-
*/
|
|
464
|
-
export enum TransactionProtocols {
|
|
465
|
-
oidc_basic = 'oidc-basic-profile',
|
|
466
|
-
/* Allows your application to have immediate access to an ID token while still providing for secure and safe retrieval of access and refresh tokens. */
|
|
467
|
-
oidc_hybrid = 'oidc-hybrid',
|
|
468
|
-
oidc_implicit = 'oidc-implicit-profile',
|
|
469
|
-
samlp = 'samlp',
|
|
470
|
-
wsfed = 'wsfed',
|
|
471
|
-
wstrust_usernamemixed = 'wstrust-usernamemixed',
|
|
472
|
-
oauth2_device_code = 'oauth2-device-code',
|
|
473
|
-
oauth2_resource_owner = 'oauth2-resource-owner',
|
|
474
|
-
oauth2_jwt_bearer = 'oauth2-resource-owner-jwt-bearer',
|
|
475
|
-
oauth2_password = 'oauth2-password',
|
|
476
|
-
oauth2_access_token = 'oauth2-access-token',
|
|
477
|
-
oauth2_refresh_token = 'oauth2-refresh-token',
|
|
478
|
-
oauth2_token_exchange = 'oauth2-token-exchange',
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
*
|
|
483
|
-
*/
|
|
484
|
-
export interface UserBase<TAppMetadata, TUserMetadata> {
|
|
485
|
-
|
|
486
|
-
/** Data that the user has read-only access to (e.g. roles, permissions, vip, etc) */
|
|
487
|
-
app_metadata: TAppMetadata
|
|
488
|
-
|
|
489
|
-
/** */
|
|
490
|
-
created_at: string
|
|
491
|
-
|
|
492
|
-
/** */
|
|
493
|
-
email: string
|
|
494
|
-
|
|
495
|
-
/** */
|
|
496
|
-
email_verified: boolean
|
|
497
|
-
|
|
498
|
-
/** */
|
|
499
|
-
family_name: string
|
|
500
|
-
|
|
501
|
-
/** */
|
|
502
|
-
given_name: string
|
|
503
|
-
|
|
504
|
-
/** */
|
|
505
|
-
identities: Identity[]
|
|
506
|
-
|
|
507
|
-
/** */
|
|
508
|
-
last_password_reset?: string
|
|
509
|
-
|
|
510
|
-
/** */
|
|
511
|
-
multifactor?: string[]
|
|
512
|
-
|
|
513
|
-
/** */
|
|
514
|
-
name: string
|
|
515
|
-
|
|
516
|
-
/** */
|
|
517
|
-
nickname: string
|
|
518
|
-
|
|
519
|
-
/** */
|
|
520
|
-
phone_number?: string
|
|
521
|
-
|
|
522
|
-
/** */
|
|
523
|
-
phone_verified?: boolean
|
|
524
|
-
|
|
525
|
-
/** */
|
|
526
|
-
picture: string
|
|
527
|
-
|
|
528
|
-
/** */
|
|
529
|
-
updated_at: string
|
|
530
|
-
|
|
531
|
-
/** */
|
|
532
|
-
user_id: string
|
|
533
|
-
|
|
534
|
-
/** Data that the user has read/write access to (e.g. color_preference, blog_url, etc.) */
|
|
535
|
-
user_metadata: TUserMetadata
|
|
536
|
-
|
|
537
|
-
/** */
|
|
538
|
-
username?: string
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
//#endregion
|
|
542
|
-
|
|
543
|
-
//#region Actions APIs
|
|
544
|
-
|
|
545
|
-
export interface PostLoginApi extends ActionsApiBase<PostLoginApi> {
|
|
546
|
-
|
|
547
|
-
/** Modify the user's login access, such as by rejecting the login attempt. */
|
|
548
|
-
access: LoginAccessManager<PostLoginApi>;
|
|
549
|
-
|
|
550
|
-
/** Request changes to the access token being issued. */
|
|
551
|
-
accessToken: AccessTokenManager<PostLoginApi>;
|
|
552
|
-
|
|
553
|
-
/** */
|
|
554
|
-
authentication: AuthenticationManager;
|
|
555
|
-
|
|
556
|
-
/** Store and retrieve data that persists across executions. */
|
|
557
|
-
cache: CacheManager;
|
|
558
|
-
|
|
559
|
-
/** Request changes to the ID token being issued. */
|
|
560
|
-
idToken: IdTokenManager;
|
|
561
|
-
|
|
562
|
-
/** */
|
|
563
|
-
multifactor: MultifactorManager;
|
|
564
|
-
|
|
565
|
-
/** */
|
|
566
|
-
redirect: RedirectManager;
|
|
567
|
-
|
|
568
|
-
/** */
|
|
569
|
-
user: UserManager;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
export interface AccessTokenManager<TApi extends ActionsApiBase<TApi>> extends AccessTokenManagerBase<TApi> {
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Add a scope on the Access Token that will be issued upon completion of the login flow.
|
|
576
|
-
* @param scope The scope to be added.
|
|
577
|
-
*/
|
|
578
|
-
addScope(scope: string): TApi;
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Remove a scope on the Access Token that will be issued upon completion of the login flow.
|
|
582
|
-
* @param scope The scope to be removed.
|
|
583
|
-
*/
|
|
584
|
-
removeScope(scope: string): TApi;
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
export interface AccessTokenManagerBase<TApi extends ActionsApiBase<TApi>> {
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Set a custom claim on the Access Token that will be issued upon completion of the login flow.
|
|
592
|
-
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
593
|
-
* @param value The value of the claim.
|
|
594
|
-
*/
|
|
595
|
-
setCustomClaim(name: string, value: any): TApi;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
export interface ActionsApiBase<TApi extends ActionsApiBase<TApi>> {
|
|
599
|
-
|
|
600
|
-
/** Modify the user's login access, such as by rejecting the login attempt. */
|
|
601
|
-
access: LoginAccessManager<TApi>;
|
|
602
|
-
|
|
603
|
-
/** Request changes to the access token being issued. */
|
|
604
|
-
accessToken: AccessTokenManagerBase<TApi>;
|
|
605
|
-
|
|
606
|
-
/** Store and retrieve data that persists across executions. */
|
|
607
|
-
cache: CacheManager;
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
export interface AuthenticationManager {
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Indicate that a custom authentication method has been completed in the current session. This method will then be available in the
|
|
615
|
-
* `event.authentication.methods` array in subsequent logins.
|
|
616
|
-
*
|
|
617
|
-
* Important: This API is only available from within the onContinuePostLogin function for PostLogin Actions. In other words, this may
|
|
618
|
-
* be used to record the completion of a custom authentication method after redirecting the user via api.redirect.sendUserTo().
|
|
619
|
-
*
|
|
620
|
-
* @param provider_url
|
|
621
|
-
*/
|
|
622
|
-
recordMethod(provider_url: string): PostLoginApi;
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Challenge the user with one or more specified multifactor authentication factors. This method presents the default challenge first,
|
|
626
|
-
* then allows the user to select a different option if additional factors have been supplied. If the user has not enrolled in any of
|
|
627
|
-
* the factors supplied (including both the default and any additional factors), the command fails.
|
|
628
|
-
*
|
|
629
|
-
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
630
|
-
* @param factor Used to specify the default MFA factor or factors used to challenge the user.
|
|
631
|
-
* @param options An object containing the optional additionalFactors field.
|
|
632
|
-
*/
|
|
633
|
-
challengeWith(factor: ChallengeFactor, options: ChallengeOptions): void
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Trigger an MFA challenge and allow the user to select their preferred factor from the supplied list. This method presents a factor picker to the user rather than a specific challenge, in accordance with the following conditions:
|
|
637
|
-
* - If two or more factors are specified, a factor picker displays to the user.
|
|
638
|
-
* - If the user has only enrolled in one of the specified factors (or only one factor is specified), the factor picker is skipped.
|
|
639
|
-
* - If the user has not enrolled in any of the specified factors, the challenge command fails.
|
|
640
|
-
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
641
|
-
* @param factors
|
|
642
|
-
*/
|
|
643
|
-
challengeWithAny(factors: ChallengeFactor[]): void
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
export interface CacheManager {
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Delete a record describing a cached value at the supplied key if it exists.
|
|
650
|
-
* @param key
|
|
651
|
-
*/
|
|
652
|
-
delete(key: string): CacheWriteResult;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Retrieve a record describing a cached value at the supplied key, if it exists. If a record is found, the cached value can be found at the value
|
|
656
|
-
* property of the returned object.
|
|
657
|
-
* @param key The key of the record stored in the cache.
|
|
658
|
-
*/
|
|
659
|
-
get(key: string): CacheRecord
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
*
|
|
663
|
-
* @param key The value of the record to be stored.
|
|
664
|
-
* @param value The value of the record to be stored.
|
|
665
|
-
* @param options Options for adjusting cache behavior.
|
|
666
|
-
*/
|
|
667
|
-
set(key: string, value: any, options?: CacheOptions): void
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
export interface CacheWriteResult {
|
|
672
|
-
|
|
673
|
-
/** */
|
|
674
|
-
type: 'success' | 'error'
|
|
675
|
-
|
|
676
|
-
/** If @see type = 'error', then the error code will be populated here. */
|
|
677
|
-
code: string
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
export interface CacheRecord {
|
|
681
|
-
|
|
682
|
-
/** The object stored in the Cache. */
|
|
683
|
-
value: any
|
|
684
|
-
|
|
685
|
-
/** The maximum expiry of the record in milliseconds since the Unix epoch. */
|
|
686
|
-
expires_at: number
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
export interface CacheOptions {
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* The absolute expiry time in milliseconds since the unix epoch. While cached records may be evicted earlier, they will never remain beyond the the supplied expires_at.
|
|
693
|
-
* NOTE: This value should not be supplied if a value was also provided for ttl. If both options are supplied, the earlier expiry of the two will be used.
|
|
694
|
-
*/
|
|
695
|
-
expires_at?: number
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* The time-to-live value of this cache entry in milliseconds. While cached values may be evicted earlier, they will never remain beyond the the supplied ttl.
|
|
699
|
-
* NOTE: This value should not be supplied if a value was also provided for expires_at. If both options are supplied, the earlier expiry of the two will be used.
|
|
700
|
-
*/
|
|
701
|
-
ttl?: number
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
export interface ChallengeFactor {
|
|
705
|
-
type: ChallengeTypes
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* When set to true, the user cannot use the OTP fallback option of the push notification factor. (Developer's note: This makes no sense.)
|
|
709
|
-
* Only used for @see ChallengeTypes.push_notification.
|
|
710
|
-
*/
|
|
711
|
-
otpFallback?: boolean
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* Only used for @see ChallengeTypes.phone.
|
|
715
|
-
*/
|
|
716
|
-
preferredMethod?: 'voice' | 'phone' | 'both'
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
export interface ChallengeOptions {
|
|
720
|
-
additionalFactors: ChallengeFactor[]
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
export enum ChallengeTypes {
|
|
724
|
-
otp = 'otp',
|
|
725
|
-
email = 'email',
|
|
726
|
-
phone = 'phone',
|
|
727
|
-
push_notification = 'push-notification',
|
|
728
|
-
webauthn_platform = 'webauthn-platform',
|
|
729
|
-
webauthn_roaming = 'webauthn-roaming'
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
export interface CredentialsExchangeApi extends ActionsApiBase<CredentialsExchangeApi> {
|
|
733
|
-
|
|
734
|
-
/** Control availability to the access token. */
|
|
735
|
-
access: LoginAccessManager<CredentialsExchangeApi>;
|
|
736
|
-
|
|
737
|
-
/** Request changes to the access token being issued. */
|
|
738
|
-
accessToken: AccessTokenManagerBase<CredentialsExchangeApi>;
|
|
739
|
-
|
|
740
|
-
/** Store and retrieve data that persists across executions. */
|
|
741
|
-
cache: CacheManager;
|
|
742
|
-
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
export interface DuoMultifactorOptions {
|
|
746
|
-
host: string
|
|
747
|
-
ikey: string
|
|
748
|
-
skey: string
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
export interface EncodeTokenOptions {
|
|
752
|
-
expiresInSeconds: number
|
|
753
|
-
payload: any;
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* A secret that will be used to sign a JWT that is shared with the redirect target.
|
|
757
|
-
* The secret value should be stored as a secret and retrieved using event.secrets['SECRET_NAME']
|
|
758
|
-
*/
|
|
759
|
-
secret: string;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
export interface IdTokenManager {
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Set a custom claim on the ID token that will be issued upon completion of the login flow.
|
|
766
|
-
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
767
|
-
* @param value The value of the claim.
|
|
768
|
-
*/
|
|
769
|
-
setCustomClaim(name: string, value: any): PostLoginApi
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
export interface LoginAccessManager<TApi extends ActionsApiBase<TApi>> {
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Mark the current login attempt as denied. This will prevent the end-user from completing the login flow. This will NOT cancel other user-related
|
|
776
|
-
* side effects (such as metadata changes) requested by this Action. The login flow will immediately stop following the completion of this action
|
|
777
|
-
* and no further Actions will be executed.
|
|
778
|
-
* @param reason A human-readable explanation for rejecting the login. This may be presented directly in end-user interfaces.
|
|
779
|
-
*/
|
|
780
|
-
deny(reason: string): TApi;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
export interface MultifactorManager {
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
*
|
|
787
|
-
* @param provider
|
|
788
|
-
* @param options
|
|
789
|
-
*/
|
|
790
|
-
enable(provider: 'any' | 'duo' | 'google-authenticator' | 'guardian' | 'none', options: MultifactorOptions): PostLoginApi
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
export interface MultifactorOptions {
|
|
794
|
-
allowRememberBrowser?: boolean
|
|
795
|
-
providerOptions?: DuoMultifactorOptions
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
export interface RedirectManager {
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
*
|
|
802
|
-
* @param options
|
|
803
|
-
*/
|
|
804
|
-
encodeToken(options: EncodeTokenOptions): string
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
*
|
|
808
|
-
* @param url
|
|
809
|
-
* @param options
|
|
810
|
-
*/
|
|
811
|
-
sendUserTo(url: string, options: { query: string }): PostLoginApi
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
*
|
|
815
|
-
* @param options
|
|
816
|
-
*/
|
|
817
|
-
validateToken(options: ValidateTokenOptions): string
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
export interface UserManager {
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
*
|
|
824
|
-
* @param name
|
|
825
|
-
* @param value
|
|
826
|
-
*/
|
|
827
|
-
setAppMetadata(name: string, value: any): PostLoginApi
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
*
|
|
831
|
-
* @param name
|
|
832
|
-
* @param value
|
|
833
|
-
*/
|
|
834
|
-
setUserMetadata(name: string, value: any): PostLoginApi
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
export interface ValidateTokenOptions {
|
|
838
|
-
secret: string;
|
|
839
|
-
tokenParameterName: string;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
//#endregion
|