auth0-actions 0.0.1
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/dist/index.d.ts +478 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/index.ts +590 -0
- package/package.json +28 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
export interface PostLoginEvent<TSecret, TAppMetadata, TUserMetadata> {
|
|
2
|
+
authentication?: AuthenticationInfoWithRiskAssessment;
|
|
3
|
+
authorization?: AuthorizationInfo;
|
|
4
|
+
cancelable?: boolean;
|
|
5
|
+
client?: Client;
|
|
6
|
+
configuration?: Configuration;
|
|
7
|
+
connection?: Connection;
|
|
8
|
+
organization?: Organization;
|
|
9
|
+
request?: RequestBase;
|
|
10
|
+
resource_server?: ResourceServer;
|
|
11
|
+
secrets?: TSecret;
|
|
12
|
+
stats?: Stats;
|
|
13
|
+
tenant?: Tenant;
|
|
14
|
+
transaction?: Transaction;
|
|
15
|
+
user?: UserBase<TAppMetadata, TUserMetadata>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Details about authentication signals obtained during the login flow.
|
|
19
|
+
*/
|
|
20
|
+
interface AuthenticationInfoWithRiskAssessment {
|
|
21
|
+
/** Contains the authentication methods a user has completed during their session. */
|
|
22
|
+
methods: AuthenticationMethod[];
|
|
23
|
+
riskAssessment?: RiskAssessmentInfo;
|
|
24
|
+
}
|
|
25
|
+
interface AuthenticationMethod {
|
|
26
|
+
/**
|
|
27
|
+
* The name of the first factor that was completed. Values include the following:
|
|
28
|
+
*/
|
|
29
|
+
name: AuthenticationMethods | string;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}
|
|
33
|
+
declare enum AuthenticationMethods {
|
|
34
|
+
/** A social or enterprise connection was used to authenticate the user as the first factor. */
|
|
35
|
+
federated = "federated",
|
|
36
|
+
/** */
|
|
37
|
+
passkey = "passkey",
|
|
38
|
+
/** A database connection was used to authenticate the user as the first factor. */
|
|
39
|
+
pwd = "pwd",
|
|
40
|
+
/** A Passwordless SMS connection was used to authenticate the user as the first factor. */
|
|
41
|
+
sms = "sms",
|
|
42
|
+
/** A Passwordless Email connection was used to authenticate the user as the first factor or verify email for password reset. */
|
|
43
|
+
email = "email",
|
|
44
|
+
/** */
|
|
45
|
+
mfa = "mfa",
|
|
46
|
+
mock = "mock"
|
|
47
|
+
}
|
|
48
|
+
interface AuthorizationInfo {
|
|
49
|
+
roles: string[];
|
|
50
|
+
}
|
|
51
|
+
interface Client {
|
|
52
|
+
clientId: string;
|
|
53
|
+
metadata: {
|
|
54
|
+
[additionalProperties: string]: string;
|
|
55
|
+
};
|
|
56
|
+
name: string;
|
|
57
|
+
strategy: string;
|
|
58
|
+
}
|
|
59
|
+
interface Configuration {
|
|
60
|
+
}
|
|
61
|
+
interface Connection {
|
|
62
|
+
/**
|
|
63
|
+
* The connection's identifier
|
|
64
|
+
*/
|
|
65
|
+
id: string;
|
|
66
|
+
/**
|
|
67
|
+
* Metadata associated with the connection in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed.
|
|
68
|
+
*/
|
|
69
|
+
metadata: {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The name of the connection
|
|
74
|
+
*/
|
|
75
|
+
name: string;
|
|
76
|
+
/**
|
|
77
|
+
* The type of the connection, related to the identity provider
|
|
78
|
+
*/
|
|
79
|
+
strategy: ConnectionStrategies;
|
|
80
|
+
}
|
|
81
|
+
declare enum ConnectionStrategies {
|
|
82
|
+
ad = "ad",
|
|
83
|
+
adfs = "adfs",
|
|
84
|
+
amazon = "amazon",
|
|
85
|
+
apple = "apple",
|
|
86
|
+
dropbox = "dropbox",
|
|
87
|
+
bitbucket = "bitbucket",
|
|
88
|
+
aol = "aol",
|
|
89
|
+
auth0_oidc = "auth0-oidc",
|
|
90
|
+
auth0 = "auth0",
|
|
91
|
+
baidu = "baidu",
|
|
92
|
+
bitly = "bitly",
|
|
93
|
+
box = "box",
|
|
94
|
+
custom = "custom",
|
|
95
|
+
daccount = "daccount",
|
|
96
|
+
dwolla = "dwolla",
|
|
97
|
+
email = "email",
|
|
98
|
+
evernote_sandbox = "evernote-sandbox",
|
|
99
|
+
evernote = "evernote",
|
|
100
|
+
exact = "exact",
|
|
101
|
+
facebook = "facebook",
|
|
102
|
+
fitbit = "fitbit",
|
|
103
|
+
flickr = "flickr",
|
|
104
|
+
github = "github",
|
|
105
|
+
google_apps = "google-apps",
|
|
106
|
+
google_oauth2 = "google-oauth2",
|
|
107
|
+
instagram = "instagram",
|
|
108
|
+
ip = "ip",
|
|
109
|
+
line = "line",
|
|
110
|
+
linkedin = "linkedin",
|
|
111
|
+
miicard = "miicard",
|
|
112
|
+
oauth1 = "oauth1",
|
|
113
|
+
oauth2 = "oauth2",
|
|
114
|
+
office365 = "office365",
|
|
115
|
+
oidc = "oidc",
|
|
116
|
+
okta = "okta",
|
|
117
|
+
paypal = "paypal",
|
|
118
|
+
paypal_sandbox = "paypal-sandbox",
|
|
119
|
+
pingfederate = "pingfederate",
|
|
120
|
+
planningcenter = "planningcenter",
|
|
121
|
+
renren = "renren",
|
|
122
|
+
salesforce_community = "salesforce-community",
|
|
123
|
+
salesforce_sandbox = "salesforce-sandbox",
|
|
124
|
+
salesforce = "salesforce",
|
|
125
|
+
samlp = "samlp",
|
|
126
|
+
sharepoint = "sharepoint",
|
|
127
|
+
shopify = "shopify",
|
|
128
|
+
sms = "sms",
|
|
129
|
+
soundcloud = "soundcloud",
|
|
130
|
+
thecity_sandbox = "thecity-sandbox",
|
|
131
|
+
thecity = "thecity",
|
|
132
|
+
thirtysevensignals = "thirtysevensignals",
|
|
133
|
+
twitter = "twitter",
|
|
134
|
+
untappd = "untappd",
|
|
135
|
+
vkontakte = "vkontakte",
|
|
136
|
+
waad = "waad",
|
|
137
|
+
weibo = "weibo",
|
|
138
|
+
windowslive = "windowslive",
|
|
139
|
+
wordpress = "wordpress",
|
|
140
|
+
yahoo = "yahoo",
|
|
141
|
+
yammer = "yammer",
|
|
142
|
+
yandex = "yandex"
|
|
143
|
+
}
|
|
144
|
+
interface GeoIP {
|
|
145
|
+
cityName: string;
|
|
146
|
+
continentCode: string;
|
|
147
|
+
countryCode3: string;
|
|
148
|
+
countryCode: string;
|
|
149
|
+
countryName: string;
|
|
150
|
+
latitude: number;
|
|
151
|
+
longitude: number;
|
|
152
|
+
subdivisionCode: string;
|
|
153
|
+
subdivisionName: string;
|
|
154
|
+
timeZone: string;
|
|
155
|
+
}
|
|
156
|
+
interface Identity {
|
|
157
|
+
connection: string;
|
|
158
|
+
isSocial: boolean;
|
|
159
|
+
provider: string;
|
|
160
|
+
userId: string;
|
|
161
|
+
user_id: string;
|
|
162
|
+
}
|
|
163
|
+
interface Organization {
|
|
164
|
+
display_name: string;
|
|
165
|
+
/**
|
|
166
|
+
* The Organization's identifier.
|
|
167
|
+
*/
|
|
168
|
+
id: string;
|
|
169
|
+
/**
|
|
170
|
+
* Metadata associated with the Organization.
|
|
171
|
+
*/
|
|
172
|
+
metadata: {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* The name of the Organization.
|
|
177
|
+
*/
|
|
178
|
+
name: string;
|
|
179
|
+
}
|
|
180
|
+
interface Query {
|
|
181
|
+
audience: string;
|
|
182
|
+
client_id: string;
|
|
183
|
+
code_challenge: string;
|
|
184
|
+
code_challenge_method: string;
|
|
185
|
+
prompt: string;
|
|
186
|
+
redirect_uri: string;
|
|
187
|
+
response_mode: string;
|
|
188
|
+
response_type: string;
|
|
189
|
+
scope: string;
|
|
190
|
+
state: string;
|
|
191
|
+
}
|
|
192
|
+
interface RequestBase {
|
|
193
|
+
ip: string;
|
|
194
|
+
method: string;
|
|
195
|
+
query: Query;
|
|
196
|
+
body: RequestBody;
|
|
197
|
+
geoip: GeoIP;
|
|
198
|
+
hostname: string;
|
|
199
|
+
user_agent: string;
|
|
200
|
+
}
|
|
201
|
+
interface RequestBody {
|
|
202
|
+
}
|
|
203
|
+
interface ResourceServer {
|
|
204
|
+
identifier: string;
|
|
205
|
+
}
|
|
206
|
+
interface RiskAssessmentInfo {
|
|
207
|
+
confidence: "low" | "medium" | "high" | "neutral";
|
|
208
|
+
version: string;
|
|
209
|
+
}
|
|
210
|
+
interface Stats {
|
|
211
|
+
logins_count: number;
|
|
212
|
+
}
|
|
213
|
+
interface Tenant {
|
|
214
|
+
id: string;
|
|
215
|
+
}
|
|
216
|
+
interface Transaction {
|
|
217
|
+
acr_values: any[];
|
|
218
|
+
linking_id?: string;
|
|
219
|
+
locale: string;
|
|
220
|
+
login_hint?: string;
|
|
221
|
+
prompt: string[];
|
|
222
|
+
protocol?: TransactionProtocols;
|
|
223
|
+
redirect_uri?: string;
|
|
224
|
+
requested_scopes: string[];
|
|
225
|
+
response_mode?: string;
|
|
226
|
+
response_type?: string[];
|
|
227
|
+
state?: string;
|
|
228
|
+
ui_locales: string[];
|
|
229
|
+
}
|
|
230
|
+
declare enum TransactionProtocols {
|
|
231
|
+
oidc_basic = "oidc-basic-profile",
|
|
232
|
+
oidc_hybrid = "oidc-hybrid",
|
|
233
|
+
oidc_implicit = "oidc-implicit-profile",
|
|
234
|
+
samlp = "samlp",
|
|
235
|
+
wsfed = "wsfed",
|
|
236
|
+
wstrust_usernamemixed = "wstrust-usernamemixed",
|
|
237
|
+
oauth2_device_code = "oauth2-device-code",
|
|
238
|
+
oauth2_resource_owner = "oauth2-resource-owner",
|
|
239
|
+
oauth2_jwt_bearer = "oauth2-resource-owner-jwt-bearer",
|
|
240
|
+
oauth2_password = "oauth2-password",
|
|
241
|
+
oauth2_access_token = "oauth2-access-token",
|
|
242
|
+
oauth2_refresh_token = "oauth2-refresh-token",
|
|
243
|
+
oauth2_token_exchange = "oauth2-token-exchange"
|
|
244
|
+
}
|
|
245
|
+
export interface UserBase<AppMetadata, UserMetadata> {
|
|
246
|
+
app_metadata: AppMetadata;
|
|
247
|
+
created_at: string;
|
|
248
|
+
email: string;
|
|
249
|
+
email_verified: boolean;
|
|
250
|
+
family_name: string;
|
|
251
|
+
given_name: string;
|
|
252
|
+
identities: Identity[];
|
|
253
|
+
last_password_reset?: string;
|
|
254
|
+
multifactor?: string[];
|
|
255
|
+
name: string;
|
|
256
|
+
nickname: string;
|
|
257
|
+
phone_number?: string;
|
|
258
|
+
phone_verified?: boolean;
|
|
259
|
+
picture: string;
|
|
260
|
+
updated_at: string;
|
|
261
|
+
user_id: string;
|
|
262
|
+
user_metadata: UserMetadata;
|
|
263
|
+
username?: string;
|
|
264
|
+
}
|
|
265
|
+
export interface PostLoginApi {
|
|
266
|
+
/** Modify the user's login access, such as by rejecting the login attempt. */
|
|
267
|
+
access: LoginAccessManager;
|
|
268
|
+
/** Request changes to the access token being issued. */
|
|
269
|
+
accessToken: AccessTokenManager;
|
|
270
|
+
authentication: AuthenticationManager;
|
|
271
|
+
/** Store and retrieve data that persists across executions. */
|
|
272
|
+
cache: CacheManager;
|
|
273
|
+
/** Request changes to the ID token being issued. */
|
|
274
|
+
idToken: IdTokenManager;
|
|
275
|
+
/** */
|
|
276
|
+
multifactor: MultifactorManager;
|
|
277
|
+
/** */
|
|
278
|
+
redirect: RedirectManager;
|
|
279
|
+
/** */
|
|
280
|
+
user: UserManager;
|
|
281
|
+
}
|
|
282
|
+
export interface AccessTokenManager {
|
|
283
|
+
/**
|
|
284
|
+
* Add a scope on the Access Token that will be issued upon completion of the login flow.
|
|
285
|
+
* @param scope The scope to be added.
|
|
286
|
+
*/
|
|
287
|
+
addScope(scope: string): PostLoginApi;
|
|
288
|
+
/**
|
|
289
|
+
* Remove a scope on the Access Token that will be issued upon completion of the login flow.
|
|
290
|
+
* @param scope The scope to be removed.
|
|
291
|
+
*/
|
|
292
|
+
removeScope(scope: string): PostLoginApi;
|
|
293
|
+
/**
|
|
294
|
+
* Set a custom claim on the Access Token that will be issued upon completion of the login flow.
|
|
295
|
+
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
296
|
+
* @param value The value of the claim.
|
|
297
|
+
*/
|
|
298
|
+
setCustomClaim(name: string, value: any): PostLoginApi;
|
|
299
|
+
}
|
|
300
|
+
export interface AuthenticationManager {
|
|
301
|
+
/**
|
|
302
|
+
* Indicate that a custom authentication method has been completed in the current session. This method will then be available in the
|
|
303
|
+
* `event.authentication.methods` array in subsequent logins.
|
|
304
|
+
*
|
|
305
|
+
* Important: This API is only available from within the onContinuePostLogin function for PostLogin Actions. In other words, this may
|
|
306
|
+
* be used to record the completion of a custom authentication method after redirecting the user via api.redirect.sendUserTo().
|
|
307
|
+
*
|
|
308
|
+
* @param provider_url
|
|
309
|
+
*/
|
|
310
|
+
recordMethod(provider_url: string): PostLoginApi;
|
|
311
|
+
/**
|
|
312
|
+
* Challenge the user with one or more specified multifactor authentication factors. This method presents the default challenge first,
|
|
313
|
+
* then allows the user to select a different option if additional factors have been supplied. If the user has not enrolled in any of
|
|
314
|
+
* the factors supplied (including both the default and any additional factors), the command fails.
|
|
315
|
+
*
|
|
316
|
+
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
317
|
+
* @param factor Used to specify the default MFA factor or factors used to challenge the user.
|
|
318
|
+
* @param options An object containing the optional additionalFactors field.
|
|
319
|
+
*/
|
|
320
|
+
challengeWith(factor: ChallengeFactor, options: ChallengeOptions): void;
|
|
321
|
+
/**
|
|
322
|
+
* 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:
|
|
323
|
+
* - If two or more factors are specified, a factor picker displays to the user.
|
|
324
|
+
* - If the user has only enrolled in one of the specified factors (or only one factor is specified), the factor picker is skipped.
|
|
325
|
+
* - If the user has not enrolled in any of the specified factors, the challenge command fails.
|
|
326
|
+
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
327
|
+
* @param factors
|
|
328
|
+
*/
|
|
329
|
+
challengeWithAny(factors: ChallengeFactor[]): void;
|
|
330
|
+
}
|
|
331
|
+
export interface CacheManager {
|
|
332
|
+
/**
|
|
333
|
+
* Delete a record describing a cached value at the supplied key if it exists.
|
|
334
|
+
* @param key
|
|
335
|
+
*/
|
|
336
|
+
delete(key: string): CacheWriteResult;
|
|
337
|
+
/**
|
|
338
|
+
* 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
|
|
339
|
+
* property of the returned object.
|
|
340
|
+
* @param key The key of the record stored in the cache.
|
|
341
|
+
*/
|
|
342
|
+
get(key: string): CacheRecord;
|
|
343
|
+
/**
|
|
344
|
+
*
|
|
345
|
+
* @param key The value of the record to be stored.
|
|
346
|
+
* @param value The value of the record to be stored.
|
|
347
|
+
* @param options Options for adjusting cache behavior.
|
|
348
|
+
*/
|
|
349
|
+
set(key: string, value: any, options?: CacheOptions): void;
|
|
350
|
+
}
|
|
351
|
+
export interface CacheWriteResult {
|
|
352
|
+
type: 'success' | 'error';
|
|
353
|
+
code: string;
|
|
354
|
+
}
|
|
355
|
+
export interface CacheRecord {
|
|
356
|
+
/** The object stored in the Cache. */
|
|
357
|
+
value: any;
|
|
358
|
+
/** The maximum expiry of the record in milliseconds since the Unix epoch. */
|
|
359
|
+
expires_at: number;
|
|
360
|
+
}
|
|
361
|
+
export interface CacheOptions {
|
|
362
|
+
/**
|
|
363
|
+
* 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.
|
|
364
|
+
* 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.
|
|
365
|
+
*/
|
|
366
|
+
expires_at?: number;
|
|
367
|
+
/**
|
|
368
|
+
* 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.
|
|
369
|
+
* 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.
|
|
370
|
+
*/
|
|
371
|
+
ttl?: number;
|
|
372
|
+
}
|
|
373
|
+
export interface ChallengeFactor {
|
|
374
|
+
type: ChallengeTypes;
|
|
375
|
+
/**
|
|
376
|
+
* When set to true, the user cannot use the OTP fallback option of the push notification factor. (Developer's note: This makes no sense.)
|
|
377
|
+
* Only used for @see ChallengeTypes.push_notification.
|
|
378
|
+
*/
|
|
379
|
+
otpFallback?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Only used for @see ChallengeTypes.phone.
|
|
382
|
+
*/
|
|
383
|
+
preferredMethod?: 'voice' | 'phone' | 'both';
|
|
384
|
+
}
|
|
385
|
+
export interface ChallengeOptions {
|
|
386
|
+
additionalFactors: ChallengeFactor[];
|
|
387
|
+
}
|
|
388
|
+
export declare enum ChallengeTypes {
|
|
389
|
+
otp = "otp",
|
|
390
|
+
email = "email",
|
|
391
|
+
phone = "phone",
|
|
392
|
+
push_notification = "push-notification",
|
|
393
|
+
webauthn_platform = "webauthn-platform",
|
|
394
|
+
webauthn_roaming = "webauthn-roaming"
|
|
395
|
+
}
|
|
396
|
+
export interface DuoMultifactorOptions {
|
|
397
|
+
host: string;
|
|
398
|
+
ikey: string;
|
|
399
|
+
skey: string;
|
|
400
|
+
}
|
|
401
|
+
export interface EncodeTokenOptions {
|
|
402
|
+
expiresInSeconds: number;
|
|
403
|
+
payload: any;
|
|
404
|
+
/**
|
|
405
|
+
* A secret that will be used to sign a JWT that is shared with the redirect target.
|
|
406
|
+
* The secret value should be stored as a secret and retrieved using event.secrets['SECRET_NAME']
|
|
407
|
+
*/
|
|
408
|
+
secret: string;
|
|
409
|
+
}
|
|
410
|
+
export interface IdTokenManager {
|
|
411
|
+
/**
|
|
412
|
+
* Set a custom claim on the ID token that will be issued upon completion of the login flow.
|
|
413
|
+
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
414
|
+
* @param value The value of the claim.
|
|
415
|
+
*/
|
|
416
|
+
setCustomClaim(name: string, value: any): PostLoginApi;
|
|
417
|
+
}
|
|
418
|
+
export interface LoginAccessManager {
|
|
419
|
+
/**
|
|
420
|
+
* 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
|
|
421
|
+
* side effects (such as metadata changes) requested by this Action. The login flow will immediately stop following the completion of this action
|
|
422
|
+
* and no further Actions will be executed.
|
|
423
|
+
* @param reason A human-readable explanation for rejecting the login. This may be presented directly in end-user interfaces.
|
|
424
|
+
*/
|
|
425
|
+
deny(reason: string): PostLoginApi;
|
|
426
|
+
}
|
|
427
|
+
export interface MultifactorManager {
|
|
428
|
+
/**
|
|
429
|
+
*
|
|
430
|
+
* @param provider
|
|
431
|
+
* @param options
|
|
432
|
+
*/
|
|
433
|
+
enable(provider: 'any' | 'duo' | 'google-authenticator' | 'guardian' | 'none', options: MultifactorOptions): PostLoginApi;
|
|
434
|
+
}
|
|
435
|
+
export interface MultifactorOptions {
|
|
436
|
+
allowRememberBrowser?: boolean;
|
|
437
|
+
providerOptions?: DuoMultifactorOptions;
|
|
438
|
+
}
|
|
439
|
+
export interface RedirectManager {
|
|
440
|
+
/**
|
|
441
|
+
*
|
|
442
|
+
* @param options
|
|
443
|
+
*/
|
|
444
|
+
encodeToken(options: EncodeTokenOptions): string;
|
|
445
|
+
/**
|
|
446
|
+
*
|
|
447
|
+
* @param url
|
|
448
|
+
* @param options
|
|
449
|
+
*/
|
|
450
|
+
sendUserTo(url: string, options: {
|
|
451
|
+
query: string;
|
|
452
|
+
}): PostLoginApi;
|
|
453
|
+
/**
|
|
454
|
+
*
|
|
455
|
+
* @param options
|
|
456
|
+
*/
|
|
457
|
+
validateToken(options: ValidateTokenOptions): string;
|
|
458
|
+
}
|
|
459
|
+
export interface UserManager {
|
|
460
|
+
/**
|
|
461
|
+
*
|
|
462
|
+
* @param name
|
|
463
|
+
* @param value
|
|
464
|
+
*/
|
|
465
|
+
setAppMetadata(name: string, value: any): PostLoginApi;
|
|
466
|
+
/**
|
|
467
|
+
*
|
|
468
|
+
* @param name
|
|
469
|
+
* @param value
|
|
470
|
+
*/
|
|
471
|
+
setUserMetadata(name: string, value: any): PostLoginApi;
|
|
472
|
+
}
|
|
473
|
+
export interface ValidateTokenOptions {
|
|
474
|
+
secret: string;
|
|
475
|
+
tokenParameterName: string;
|
|
476
|
+
}
|
|
477
|
+
export {};
|
|
478
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa;IAEhE,cAAc,CAAC,EAAE,oCAAoC,CAAA;IAErD,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAElC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;CAChD;AAID;;GAEG;AACH,UAAU,oCAAoC;IAE1C,qFAAqF;IACrF,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAEhC,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAED,UAAU,oBAAoB;IAC1B;;OAEG;IACH,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAAC;IAErC,SAAS,EAAE,MAAM,CAAC;IAGlB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,aAAK,qBAAqB;IAEtB,+FAA+F;IAC/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;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,sBAAsB,GAAG,UAAU,GAAG,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,YAAY,CAAA;CAC5H;AAED,MAAM,WAAW,kBAAkB;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,eAAe,CAAC,EAAE,qBAAqB,CAAA;CAC1C;AAED,MAAM,WAAW,eAAe;IAE5B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAAA;IAEhD;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAA;IAEjE;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAAA;CACvD;AAED,MAAM,WAAW,WAAW;IAExB;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,YAAY,CAAA;IAEtD;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,YAAY,CAAA;CAC1D;AAED,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;CAC9B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Post-Login Event
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ChallengeTypes = void 0;
|
|
5
|
+
var AuthenticationMethods;
|
|
6
|
+
(function (AuthenticationMethods) {
|
|
7
|
+
/** A social or enterprise connection was used to authenticate the user as the first factor. */
|
|
8
|
+
AuthenticationMethods["federated"] = "federated";
|
|
9
|
+
/** */
|
|
10
|
+
AuthenticationMethods["passkey"] = "passkey";
|
|
11
|
+
/** A database connection was used to authenticate the user as the first factor. */
|
|
12
|
+
AuthenticationMethods["pwd"] = "pwd";
|
|
13
|
+
/** A Passwordless SMS connection was used to authenticate the user as the first factor. */
|
|
14
|
+
AuthenticationMethods["sms"] = "sms";
|
|
15
|
+
/** A Passwordless Email connection was used to authenticate the user as the first factor or verify email for password reset. */
|
|
16
|
+
AuthenticationMethods["email"] = "email";
|
|
17
|
+
/** */
|
|
18
|
+
AuthenticationMethods["mfa"] = "mfa";
|
|
19
|
+
/* "Used for internal testing. */
|
|
20
|
+
AuthenticationMethods["mock"] = "mock";
|
|
21
|
+
})(AuthenticationMethods || (AuthenticationMethods = {}));
|
|
22
|
+
var ConnectionStrategies;
|
|
23
|
+
(function (ConnectionStrategies) {
|
|
24
|
+
ConnectionStrategies["ad"] = "ad";
|
|
25
|
+
ConnectionStrategies["adfs"] = "adfs";
|
|
26
|
+
ConnectionStrategies["amazon"] = "amazon";
|
|
27
|
+
ConnectionStrategies["apple"] = "apple";
|
|
28
|
+
ConnectionStrategies["dropbox"] = "dropbox";
|
|
29
|
+
ConnectionStrategies["bitbucket"] = "bitbucket";
|
|
30
|
+
ConnectionStrategies["aol"] = "aol";
|
|
31
|
+
ConnectionStrategies["auth0_oidc"] = "auth0-oidc";
|
|
32
|
+
ConnectionStrategies["auth0"] = "auth0";
|
|
33
|
+
ConnectionStrategies["baidu"] = "baidu";
|
|
34
|
+
ConnectionStrategies["bitly"] = "bitly";
|
|
35
|
+
ConnectionStrategies["box"] = "box";
|
|
36
|
+
ConnectionStrategies["custom"] = "custom";
|
|
37
|
+
ConnectionStrategies["daccount"] = "daccount";
|
|
38
|
+
ConnectionStrategies["dwolla"] = "dwolla";
|
|
39
|
+
ConnectionStrategies["email"] = "email";
|
|
40
|
+
ConnectionStrategies["evernote_sandbox"] = "evernote-sandbox";
|
|
41
|
+
ConnectionStrategies["evernote"] = "evernote";
|
|
42
|
+
ConnectionStrategies["exact"] = "exact";
|
|
43
|
+
ConnectionStrategies["facebook"] = "facebook";
|
|
44
|
+
ConnectionStrategies["fitbit"] = "fitbit";
|
|
45
|
+
ConnectionStrategies["flickr"] = "flickr";
|
|
46
|
+
ConnectionStrategies["github"] = "github";
|
|
47
|
+
ConnectionStrategies["google_apps"] = "google-apps";
|
|
48
|
+
ConnectionStrategies["google_oauth2"] = "google-oauth2";
|
|
49
|
+
ConnectionStrategies["instagram"] = "instagram";
|
|
50
|
+
ConnectionStrategies["ip"] = "ip";
|
|
51
|
+
ConnectionStrategies["line"] = "line";
|
|
52
|
+
ConnectionStrategies["linkedin"] = "linkedin";
|
|
53
|
+
ConnectionStrategies["miicard"] = "miicard";
|
|
54
|
+
ConnectionStrategies["oauth1"] = "oauth1";
|
|
55
|
+
ConnectionStrategies["oauth2"] = "oauth2";
|
|
56
|
+
ConnectionStrategies["office365"] = "office365";
|
|
57
|
+
ConnectionStrategies["oidc"] = "oidc";
|
|
58
|
+
ConnectionStrategies["okta"] = "okta";
|
|
59
|
+
ConnectionStrategies["paypal"] = "paypal";
|
|
60
|
+
ConnectionStrategies["paypal_sandbox"] = "paypal-sandbox";
|
|
61
|
+
ConnectionStrategies["pingfederate"] = "pingfederate";
|
|
62
|
+
ConnectionStrategies["planningcenter"] = "planningcenter";
|
|
63
|
+
ConnectionStrategies["renren"] = "renren";
|
|
64
|
+
ConnectionStrategies["salesforce_community"] = "salesforce-community";
|
|
65
|
+
ConnectionStrategies["salesforce_sandbox"] = "salesforce-sandbox";
|
|
66
|
+
ConnectionStrategies["salesforce"] = "salesforce";
|
|
67
|
+
ConnectionStrategies["samlp"] = "samlp";
|
|
68
|
+
ConnectionStrategies["sharepoint"] = "sharepoint";
|
|
69
|
+
ConnectionStrategies["shopify"] = "shopify";
|
|
70
|
+
ConnectionStrategies["sms"] = "sms";
|
|
71
|
+
ConnectionStrategies["soundcloud"] = "soundcloud";
|
|
72
|
+
ConnectionStrategies["thecity_sandbox"] = "thecity-sandbox";
|
|
73
|
+
ConnectionStrategies["thecity"] = "thecity";
|
|
74
|
+
ConnectionStrategies["thirtysevensignals"] = "thirtysevensignals";
|
|
75
|
+
ConnectionStrategies["twitter"] = "twitter";
|
|
76
|
+
ConnectionStrategies["untappd"] = "untappd";
|
|
77
|
+
ConnectionStrategies["vkontakte"] = "vkontakte";
|
|
78
|
+
ConnectionStrategies["waad"] = "waad";
|
|
79
|
+
ConnectionStrategies["weibo"] = "weibo";
|
|
80
|
+
ConnectionStrategies["windowslive"] = "windowslive";
|
|
81
|
+
ConnectionStrategies["wordpress"] = "wordpress";
|
|
82
|
+
ConnectionStrategies["yahoo"] = "yahoo";
|
|
83
|
+
ConnectionStrategies["yammer"] = "yammer";
|
|
84
|
+
ConnectionStrategies["yandex"] = "yandex";
|
|
85
|
+
})(ConnectionStrategies || (ConnectionStrategies = {}));
|
|
86
|
+
var TransactionProtocols;
|
|
87
|
+
(function (TransactionProtocols) {
|
|
88
|
+
TransactionProtocols["oidc_basic"] = "oidc-basic-profile";
|
|
89
|
+
/* Allows your application to have immediate access to an ID token while still providing for secure and safe retrieval of access and refresh tokens. */
|
|
90
|
+
TransactionProtocols["oidc_hybrid"] = "oidc-hybrid";
|
|
91
|
+
TransactionProtocols["oidc_implicit"] = "oidc-implicit-profile";
|
|
92
|
+
TransactionProtocols["samlp"] = "samlp";
|
|
93
|
+
TransactionProtocols["wsfed"] = "wsfed";
|
|
94
|
+
TransactionProtocols["wstrust_usernamemixed"] = "wstrust-usernamemixed";
|
|
95
|
+
TransactionProtocols["oauth2_device_code"] = "oauth2-device-code";
|
|
96
|
+
TransactionProtocols["oauth2_resource_owner"] = "oauth2-resource-owner";
|
|
97
|
+
TransactionProtocols["oauth2_jwt_bearer"] = "oauth2-resource-owner-jwt-bearer";
|
|
98
|
+
TransactionProtocols["oauth2_password"] = "oauth2-password";
|
|
99
|
+
TransactionProtocols["oauth2_access_token"] = "oauth2-access-token";
|
|
100
|
+
TransactionProtocols["oauth2_refresh_token"] = "oauth2-refresh-token";
|
|
101
|
+
TransactionProtocols["oauth2_token_exchange"] = "oauth2-token-exchange";
|
|
102
|
+
})(TransactionProtocols || (TransactionProtocols = {}));
|
|
103
|
+
var ChallengeTypes;
|
|
104
|
+
(function (ChallengeTypes) {
|
|
105
|
+
ChallengeTypes["otp"] = "otp";
|
|
106
|
+
ChallengeTypes["email"] = "email";
|
|
107
|
+
ChallengeTypes["phone"] = "phone";
|
|
108
|
+
ChallengeTypes["push_notification"] = "push-notification";
|
|
109
|
+
ChallengeTypes["webauthn_platform"] = "webauthn-platform";
|
|
110
|
+
ChallengeTypes["webauthn_roaming"] = "webauthn-roaming";
|
|
111
|
+
})(ChallengeTypes || (exports.ChallengeTypes = ChallengeTypes = {}));
|
|
112
|
+
//#endregion
|
|
113
|
+
//notes: make a C# version too.
|
|
114
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AACA,0BAA0B;;;AA+C1B,IAAK,qBAsBJ;AAtBD,WAAK,qBAAqB;IAEtB,+FAA+F;IAC/F,gDAAuB,CAAA;IAEvB,OAAO;IACP,4CAAmB,CAAA;IAEnB,mFAAmF;IACnF,oCAAW,CAAA;IAEX,2FAA2F;IAC3F,oCAAW,CAAA;IAEX,gIAAgI;IAChI,wCAAe,CAAA;IAEf,OAAO;IACP,oCAAW,CAAA;IAEX,iCAAiC;IACjC,sCAAa,CAAA;AACjB,CAAC,EAtBI,qBAAqB,KAArB,qBAAqB,QAsBzB;AAgDD,IAAK,oBA8DJ;AA9DD,WAAK,oBAAoB;IACrB,iCAAS,CAAA;IACT,qCAAa,CAAA;IACb,yCAAiB,CAAA;IACjB,uCAAe,CAAA;IACf,2CAAmB,CAAA;IACnB,+CAAuB,CAAA;IACvB,mCAAW,CAAA;IACX,iDAAyB,CAAA;IACzB,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACj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/C,8EAAsD,CAAA;IACtD,2DAAmC,CAAA;IACnC,mEAA2C,CAAA;IAC3C,qEAA6C,CAAA;IAC7C,uEAA+C,CAAA;AACnD,CAAC,EAfI,oBAAoB,KAApB,oBAAoB,QAexB;AAwLD,IAAY,cAOX;AAPD,WAAY,cAAc;IACtB,6BAAW,CAAA;IACX,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,yDAAuC,CAAA;IACvC,yDAAuC,CAAA;IACvC,uDAAqC,CAAA;AACzC,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAmGD,YAAY;AAGZ,+BAA+B"}
|
package/index.ts
ADDED
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
|
|
2
|
+
//#region Post-Login Event
|
|
3
|
+
|
|
4
|
+
export interface PostLoginEvent<TSecret, TAppMetadata, TUserMetadata> {
|
|
5
|
+
/* Details about authentication signals obtained during the login flow. */
|
|
6
|
+
authentication?: AuthenticationInfoWithRiskAssessment
|
|
7
|
+
/* An object containing information describing the authorization granted to the user who is logging in. */
|
|
8
|
+
authorization?: AuthorizationInfo;
|
|
9
|
+
/* True if the event was created with the cancelable option */
|
|
10
|
+
cancelable?: boolean;
|
|
11
|
+
client?: Client;
|
|
12
|
+
configuration?: Configuration;
|
|
13
|
+
connection?: Connection;
|
|
14
|
+
organization?: Organization;
|
|
15
|
+
request?: RequestBase;
|
|
16
|
+
resource_server?: ResourceServer;
|
|
17
|
+
secrets?: TSecret;
|
|
18
|
+
stats?: Stats;
|
|
19
|
+
tenant?: Tenant;
|
|
20
|
+
transaction?: Transaction;
|
|
21
|
+
user?: UserBase<TAppMetadata, TUserMetadata>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Details about authentication signals obtained during the login flow.
|
|
28
|
+
*/
|
|
29
|
+
interface AuthenticationInfoWithRiskAssessment {
|
|
30
|
+
|
|
31
|
+
/** Contains the authentication methods a user has completed during their session. */
|
|
32
|
+
methods: AuthenticationMethod[];
|
|
33
|
+
|
|
34
|
+
riskAssessment?: RiskAssessmentInfo;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface AuthenticationMethod {
|
|
38
|
+
/**
|
|
39
|
+
* The name of the first factor that was completed. Values include the following:
|
|
40
|
+
*/
|
|
41
|
+
name: AuthenticationMethods | string;
|
|
42
|
+
|
|
43
|
+
timestamp: string;
|
|
44
|
+
|
|
45
|
+
/* A specific MFA factor. Only present when name is set to 'mfa'. */
|
|
46
|
+
type: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
enum AuthenticationMethods {
|
|
50
|
+
|
|
51
|
+
/** A social or enterprise connection was used to authenticate the user as the first factor. */
|
|
52
|
+
federated = 'federated',
|
|
53
|
+
|
|
54
|
+
/** */
|
|
55
|
+
passkey = 'passkey',
|
|
56
|
+
|
|
57
|
+
/** A database connection was used to authenticate the user as the first factor. */
|
|
58
|
+
pwd = 'pwd',
|
|
59
|
+
|
|
60
|
+
/** A Passwordless SMS connection was used to authenticate the user as the first factor. */
|
|
61
|
+
sms = 'sms',
|
|
62
|
+
|
|
63
|
+
/** A Passwordless Email connection was used to authenticate the user as the first factor or verify email for password reset. */
|
|
64
|
+
email = 'email',
|
|
65
|
+
|
|
66
|
+
/** */
|
|
67
|
+
mfa = 'mfa',
|
|
68
|
+
|
|
69
|
+
/* "Used for internal testing. */
|
|
70
|
+
mock = 'mock'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface AuthorizationInfo {
|
|
74
|
+
roles: string[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface Client {
|
|
78
|
+
|
|
79
|
+
/* The client id of the application the user is logging in to. */
|
|
80
|
+
clientId: string;
|
|
81
|
+
|
|
82
|
+
/* An object for holding other application properties. */
|
|
83
|
+
metadata: { [additionalProperties: string]: string; };
|
|
84
|
+
|
|
85
|
+
/* The name of the application (as defined in the Dashboard). */
|
|
86
|
+
name: string;
|
|
87
|
+
|
|
88
|
+
strategy: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface Configuration {
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface Connection {
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The connection's identifier
|
|
99
|
+
*/
|
|
100
|
+
id: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Metadata associated with the connection in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed.
|
|
104
|
+
*/
|
|
105
|
+
metadata: { [key: string]: any };
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The name of the connection
|
|
109
|
+
*/
|
|
110
|
+
name: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The type of the connection, related to the identity provider
|
|
114
|
+
*/
|
|
115
|
+
strategy: ConnectionStrategies;
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
enum ConnectionStrategies {
|
|
120
|
+
ad = 'ad',
|
|
121
|
+
adfs = 'adfs',
|
|
122
|
+
amazon = 'amazon',
|
|
123
|
+
apple = 'apple',
|
|
124
|
+
dropbox = 'dropbox',
|
|
125
|
+
bitbucket = 'bitbucket',
|
|
126
|
+
aol = 'aol',
|
|
127
|
+
auth0_oidc = 'auth0-oidc',
|
|
128
|
+
auth0 = 'auth0',
|
|
129
|
+
baidu = 'baidu',
|
|
130
|
+
bitly = 'bitly',
|
|
131
|
+
box = 'box',
|
|
132
|
+
custom = 'custom',
|
|
133
|
+
daccount = 'daccount',
|
|
134
|
+
dwolla = 'dwolla',
|
|
135
|
+
email = 'email',
|
|
136
|
+
evernote_sandbox = 'evernote-sandbox',
|
|
137
|
+
evernote = 'evernote',
|
|
138
|
+
exact = 'exact',
|
|
139
|
+
facebook = 'facebook',
|
|
140
|
+
fitbit = 'fitbit',
|
|
141
|
+
flickr = 'flickr',
|
|
142
|
+
github = 'github',
|
|
143
|
+
google_apps = 'google-apps',
|
|
144
|
+
google_oauth2 = 'google-oauth2',
|
|
145
|
+
instagram = 'instagram',
|
|
146
|
+
ip = 'ip',
|
|
147
|
+
line = 'line',
|
|
148
|
+
linkedin = 'linkedin',
|
|
149
|
+
miicard = 'miicard',
|
|
150
|
+
oauth1 = 'oauth1',
|
|
151
|
+
oauth2 = 'oauth2',
|
|
152
|
+
office365 = 'office365',
|
|
153
|
+
oidc = 'oidc',
|
|
154
|
+
okta = 'okta',
|
|
155
|
+
paypal = 'paypal',
|
|
156
|
+
paypal_sandbox = 'paypal-sandbox',
|
|
157
|
+
pingfederate = 'pingfederate',
|
|
158
|
+
planningcenter = 'planningcenter',
|
|
159
|
+
renren = 'renren',
|
|
160
|
+
salesforce_community = 'salesforce-community',
|
|
161
|
+
salesforce_sandbox = 'salesforce-sandbox',
|
|
162
|
+
salesforce = 'salesforce',
|
|
163
|
+
samlp = 'samlp',
|
|
164
|
+
sharepoint = 'sharepoint',
|
|
165
|
+
shopify = 'shopify',
|
|
166
|
+
sms = 'sms',
|
|
167
|
+
soundcloud = 'soundcloud',
|
|
168
|
+
thecity_sandbox = 'thecity-sandbox',
|
|
169
|
+
thecity = 'thecity',
|
|
170
|
+
thirtysevensignals = 'thirtysevensignals',
|
|
171
|
+
twitter = 'twitter',
|
|
172
|
+
untappd = 'untappd',
|
|
173
|
+
vkontakte = 'vkontakte',
|
|
174
|
+
waad = 'waad',
|
|
175
|
+
weibo = 'weibo',
|
|
176
|
+
windowslive = 'windowslive',
|
|
177
|
+
wordpress = 'wordpress',
|
|
178
|
+
yahoo = 'yahoo',
|
|
179
|
+
yammer = 'yammer',
|
|
180
|
+
yandex = 'yandex',
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface GeoIP {
|
|
184
|
+
cityName: string
|
|
185
|
+
continentCode: string
|
|
186
|
+
countryCode3: string
|
|
187
|
+
countryCode: string
|
|
188
|
+
countryName: string
|
|
189
|
+
latitude: number
|
|
190
|
+
longitude: number
|
|
191
|
+
subdivisionCode: string
|
|
192
|
+
subdivisionName: string
|
|
193
|
+
timeZone: string
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface Identity {
|
|
197
|
+
connection: string
|
|
198
|
+
isSocial: boolean
|
|
199
|
+
provider: string
|
|
200
|
+
userId: string
|
|
201
|
+
user_id: string
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface Organization {
|
|
205
|
+
|
|
206
|
+
/* The friendly name of the Organization. */
|
|
207
|
+
display_name: string;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The Organization's identifier.
|
|
211
|
+
*/
|
|
212
|
+
id: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Metadata associated with the Organization.
|
|
216
|
+
*/
|
|
217
|
+
metadata: { [key: string]: any };
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The name of the Organization.
|
|
221
|
+
*/
|
|
222
|
+
name: string;
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
interface Query {
|
|
227
|
+
audience: string
|
|
228
|
+
client_id: string
|
|
229
|
+
code_challenge: string
|
|
230
|
+
code_challenge_method: string
|
|
231
|
+
prompt: string
|
|
232
|
+
redirect_uri: string
|
|
233
|
+
response_mode: string
|
|
234
|
+
response_type: string
|
|
235
|
+
scope: string
|
|
236
|
+
state: string
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface RequestBase {
|
|
240
|
+
ip: string;
|
|
241
|
+
method: string;
|
|
242
|
+
query: Query;
|
|
243
|
+
body: RequestBody;
|
|
244
|
+
geoip: GeoIP;
|
|
245
|
+
hostname: string;
|
|
246
|
+
user_agent: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface RequestBody { }
|
|
250
|
+
|
|
251
|
+
interface ResourceServer {
|
|
252
|
+
identifier: string
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
interface RiskAssessmentInfo {
|
|
256
|
+
confidence: "low" | "medium" | "high" | "neutral";
|
|
257
|
+
version: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
interface Stats {
|
|
261
|
+
logins_count: number
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface Tenant {
|
|
265
|
+
id: string
|
|
266
|
+
}
|
|
267
|
+
interface Transaction {
|
|
268
|
+
acr_values: any[]
|
|
269
|
+
linking_id?: string
|
|
270
|
+
locale: string
|
|
271
|
+
login_hint?: string
|
|
272
|
+
prompt: string[]
|
|
273
|
+
protocol?: TransactionProtocols
|
|
274
|
+
redirect_uri?: string
|
|
275
|
+
requested_scopes: string[]
|
|
276
|
+
response_mode?: string
|
|
277
|
+
response_type?: string[]
|
|
278
|
+
state?: string
|
|
279
|
+
ui_locales: string[]
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
enum TransactionProtocols {
|
|
283
|
+
oidc_basic = 'oidc-basic-profile',
|
|
284
|
+
/* Allows your application to have immediate access to an ID token while still providing for secure and safe retrieval of access and refresh tokens. */
|
|
285
|
+
oidc_hybrid = 'oidc-hybrid',
|
|
286
|
+
oidc_implicit = 'oidc-implicit-profile',
|
|
287
|
+
samlp = 'samlp',
|
|
288
|
+
wsfed = 'wsfed',
|
|
289
|
+
wstrust_usernamemixed = 'wstrust-usernamemixed',
|
|
290
|
+
oauth2_device_code = 'oauth2-device-code',
|
|
291
|
+
oauth2_resource_owner = 'oauth2-resource-owner',
|
|
292
|
+
oauth2_jwt_bearer = 'oauth2-resource-owner-jwt-bearer',
|
|
293
|
+
oauth2_password = 'oauth2-password',
|
|
294
|
+
oauth2_access_token = 'oauth2-access-token',
|
|
295
|
+
oauth2_refresh_token = 'oauth2-refresh-token',
|
|
296
|
+
oauth2_token_exchange = 'oauth2-token-exchange',
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
export interface UserBase<AppMetadata, UserMetadata> {
|
|
301
|
+
app_metadata: AppMetadata
|
|
302
|
+
created_at: string
|
|
303
|
+
email: string
|
|
304
|
+
email_verified: boolean
|
|
305
|
+
family_name: string
|
|
306
|
+
given_name: string
|
|
307
|
+
identities: Identity[]
|
|
308
|
+
last_password_reset?: string
|
|
309
|
+
multifactor?: string[]
|
|
310
|
+
name: string
|
|
311
|
+
nickname: string
|
|
312
|
+
phone_number?: string
|
|
313
|
+
phone_verified?: boolean
|
|
314
|
+
picture: string
|
|
315
|
+
updated_at: string
|
|
316
|
+
user_id: string
|
|
317
|
+
user_metadata: UserMetadata
|
|
318
|
+
username?: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
|
|
323
|
+
//#region Post-Login API
|
|
324
|
+
|
|
325
|
+
export interface PostLoginApi {
|
|
326
|
+
|
|
327
|
+
/** Modify the user's login access, such as by rejecting the login attempt. */
|
|
328
|
+
access: LoginAccessManager;
|
|
329
|
+
|
|
330
|
+
/** Request changes to the access token being issued. */
|
|
331
|
+
accessToken: AccessTokenManager;
|
|
332
|
+
|
|
333
|
+
authentication: AuthenticationManager;
|
|
334
|
+
|
|
335
|
+
/** Store and retrieve data that persists across executions. */
|
|
336
|
+
cache: CacheManager;
|
|
337
|
+
|
|
338
|
+
/** Request changes to the ID token being issued. */
|
|
339
|
+
idToken: IdTokenManager;
|
|
340
|
+
|
|
341
|
+
/** */
|
|
342
|
+
multifactor: MultifactorManager;
|
|
343
|
+
|
|
344
|
+
/** */
|
|
345
|
+
redirect: RedirectManager;
|
|
346
|
+
|
|
347
|
+
/** */
|
|
348
|
+
user: UserManager;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface AccessTokenManager {
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Add a scope on the Access Token that will be issued upon completion of the login flow.
|
|
355
|
+
* @param scope The scope to be added.
|
|
356
|
+
*/
|
|
357
|
+
addScope(scope: string): PostLoginApi;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Remove a scope on the Access Token that will be issued upon completion of the login flow.
|
|
361
|
+
* @param scope The scope to be removed.
|
|
362
|
+
*/
|
|
363
|
+
removeScope(scope: string): PostLoginApi;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Set a custom claim on the Access Token that will be issued upon completion of the login flow.
|
|
367
|
+
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
368
|
+
* @param value The value of the claim.
|
|
369
|
+
*/
|
|
370
|
+
setCustomClaim(name: string, value: any): PostLoginApi;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface AuthenticationManager {
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Indicate that a custom authentication method has been completed in the current session. This method will then be available in the
|
|
377
|
+
* `event.authentication.methods` array in subsequent logins.
|
|
378
|
+
*
|
|
379
|
+
* Important: This API is only available from within the onContinuePostLogin function for PostLogin Actions. In other words, this may
|
|
380
|
+
* be used to record the completion of a custom authentication method after redirecting the user via api.redirect.sendUserTo().
|
|
381
|
+
*
|
|
382
|
+
* @param provider_url
|
|
383
|
+
*/
|
|
384
|
+
recordMethod(provider_url: string): PostLoginApi;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Challenge the user with one or more specified multifactor authentication factors. This method presents the default challenge first,
|
|
388
|
+
* then allows the user to select a different option if additional factors have been supplied. If the user has not enrolled in any of
|
|
389
|
+
* the factors supplied (including both the default and any additional factors), the command fails.
|
|
390
|
+
*
|
|
391
|
+
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
392
|
+
* @param factor Used to specify the default MFA factor or factors used to challenge the user.
|
|
393
|
+
* @param options An object containing the optional additionalFactors field.
|
|
394
|
+
*/
|
|
395
|
+
challengeWith(factor: ChallengeFactor, options: ChallengeOptions): void
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* 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:
|
|
399
|
+
* - If two or more factors are specified, a factor picker displays to the user.
|
|
400
|
+
* - If the user has only enrolled in one of the specified factors (or only one factor is specified), the factor picker is skipped.
|
|
401
|
+
* - If the user has not enrolled in any of the specified factors, the challenge command fails.
|
|
402
|
+
* Note: This method overrides existing policies and rules that enable or disable MFA in a tenant.
|
|
403
|
+
* @param factors
|
|
404
|
+
*/
|
|
405
|
+
challengeWithAny(factors: ChallengeFactor[]): void
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface CacheManager {
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Delete a record describing a cached value at the supplied key if it exists.
|
|
412
|
+
* @param key
|
|
413
|
+
*/
|
|
414
|
+
delete(key: string): CacheWriteResult;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* 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
|
|
418
|
+
* property of the returned object.
|
|
419
|
+
* @param key The key of the record stored in the cache.
|
|
420
|
+
*/
|
|
421
|
+
get(key: string): CacheRecord
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
*
|
|
425
|
+
* @param key The value of the record to be stored.
|
|
426
|
+
* @param value The value of the record to be stored.
|
|
427
|
+
* @param options Options for adjusting cache behavior.
|
|
428
|
+
*/
|
|
429
|
+
set(key: string, value: any, options?: CacheOptions): void
|
|
430
|
+
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface CacheWriteResult {
|
|
434
|
+
type: 'success' | 'error'
|
|
435
|
+
code: string
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface CacheRecord {
|
|
439
|
+
|
|
440
|
+
/** The object stored in the Cache. */
|
|
441
|
+
value: any
|
|
442
|
+
|
|
443
|
+
/** The maximum expiry of the record in milliseconds since the Unix epoch. */
|
|
444
|
+
expires_at: number
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface CacheOptions {
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* 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.
|
|
451
|
+
* 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.
|
|
452
|
+
*/
|
|
453
|
+
expires_at?: number
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* 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.
|
|
457
|
+
* 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.
|
|
458
|
+
*/
|
|
459
|
+
ttl?: number
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface ChallengeFactor {
|
|
463
|
+
type: ChallengeTypes
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* When set to true, the user cannot use the OTP fallback option of the push notification factor. (Developer's note: This makes no sense.)
|
|
467
|
+
* Only used for @see ChallengeTypes.push_notification.
|
|
468
|
+
*/
|
|
469
|
+
otpFallback?: boolean
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Only used for @see ChallengeTypes.phone.
|
|
473
|
+
*/
|
|
474
|
+
preferredMethod?: 'voice' | 'phone' | 'both'
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface ChallengeOptions {
|
|
478
|
+
additionalFactors: ChallengeFactor[]
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export enum ChallengeTypes {
|
|
482
|
+
otp = 'otp',
|
|
483
|
+
email = 'email',
|
|
484
|
+
phone = 'phone',
|
|
485
|
+
push_notification = 'push-notification',
|
|
486
|
+
webauthn_platform = 'webauthn-platform',
|
|
487
|
+
webauthn_roaming = 'webauthn-roaming'
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface DuoMultifactorOptions {
|
|
491
|
+
host: string
|
|
492
|
+
ikey: string
|
|
493
|
+
skey: string
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface EncodeTokenOptions {
|
|
497
|
+
expiresInSeconds: number
|
|
498
|
+
payload: any;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* A secret that will be used to sign a JWT that is shared with the redirect target.
|
|
502
|
+
* The secret value should be stored as a secret and retrieved using event.secrets['SECRET_NAME']
|
|
503
|
+
*/
|
|
504
|
+
secret: string;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface IdTokenManager {
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Set a custom claim on the ID token that will be issued upon completion of the login flow.
|
|
511
|
+
* @param name Name of the claim (note that this may need to be a fully-qualified URL).
|
|
512
|
+
* @param value The value of the claim.
|
|
513
|
+
*/
|
|
514
|
+
setCustomClaim(name: string, value: any): PostLoginApi
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface LoginAccessManager {
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* 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
|
|
521
|
+
* side effects (such as metadata changes) requested by this Action. The login flow will immediately stop following the completion of this action
|
|
522
|
+
* and no further Actions will be executed.
|
|
523
|
+
* @param reason A human-readable explanation for rejecting the login. This may be presented directly in end-user interfaces.
|
|
524
|
+
*/
|
|
525
|
+
deny(reason: string): PostLoginApi;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export interface MultifactorManager {
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
*
|
|
532
|
+
* @param provider
|
|
533
|
+
* @param options
|
|
534
|
+
*/
|
|
535
|
+
enable(provider: 'any' | 'duo' | 'google-authenticator' | 'guardian' | 'none', options: MultifactorOptions): PostLoginApi
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface MultifactorOptions {
|
|
539
|
+
allowRememberBrowser?: boolean
|
|
540
|
+
providerOptions?: DuoMultifactorOptions
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface RedirectManager {
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
*
|
|
547
|
+
* @param options
|
|
548
|
+
*/
|
|
549
|
+
encodeToken(options: EncodeTokenOptions): string
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
*
|
|
553
|
+
* @param url
|
|
554
|
+
* @param options
|
|
555
|
+
*/
|
|
556
|
+
sendUserTo(url: string, options: { query: string }): PostLoginApi
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
*
|
|
560
|
+
* @param options
|
|
561
|
+
*/
|
|
562
|
+
validateToken(options: ValidateTokenOptions): string
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export interface UserManager {
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
*
|
|
569
|
+
* @param name
|
|
570
|
+
* @param value
|
|
571
|
+
*/
|
|
572
|
+
setAppMetadata(name: string, value: any): PostLoginApi
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
*
|
|
576
|
+
* @param name
|
|
577
|
+
* @param value
|
|
578
|
+
*/
|
|
579
|
+
setUserMetadata(name: string, value: any): PostLoginApi
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export interface ValidateTokenOptions {
|
|
583
|
+
secret: string;
|
|
584
|
+
tokenParameterName: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
//#endregion
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
//notes: make a C# version too.
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auth0-actions",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Type definitions and utilities for building Auth0 Actions.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsc --build",
|
|
10
|
+
"clean": "tsc --build --clean"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"auth0",
|
|
14
|
+
"actions"
|
|
15
|
+
],
|
|
16
|
+
"author": "CloudNimble, Inc. opensource@nimbleapps.cloud",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"auth0": "^4.0.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/auth0": "^3.3.6",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
24
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
25
|
+
"eslint": "^8.50.0",
|
|
26
|
+
"typescript": "^5.2.2"
|
|
27
|
+
}
|
|
28
|
+
}
|