Skip to content

Commit 45a61bd

Browse files
Merge branch 'develop' of github.com:FusionAuth/fusionauth-typescript-client into feature/admin-app-reskin
2 parents 49177bc + 3992acd commit 45a61bd

File tree

1 file changed

+175
-1
lines changed

1 file changed

+175
-1
lines changed

src/FusionAuthClient.ts

Lines changed: 175 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,26 @@ export class FusionAuthClient {
232232
.go();
233233
}
234234

235+
/**
236+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
237+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
238+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
239+
*
240+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
241+
*
242+
* @param {string} changePasswordId The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
243+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
244+
* @returns {Promise<ClientResponse<void>>}
245+
*/
246+
checkChangePasswordUsingIdAndIPAddress(changePasswordId: string, ipAddress: string): Promise<ClientResponse<void>> {
247+
return this.startAnonymous<void, Errors>()
248+
.withUri('/api/user/change-password')
249+
.withUriSegment(changePasswordId)
250+
.withParameter('ipAddress', ipAddress)
251+
.withMethod("GET")
252+
.go();
253+
}
254+
235255
/**
236256
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
237257
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -250,6 +270,26 @@ export class FusionAuthClient {
250270
.go();
251271
}
252272

273+
/**
274+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
275+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
276+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
277+
*
278+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
279+
*
280+
* @param {string} encodedJWT The encoded JWT (access token).
281+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
282+
* @returns {Promise<ClientResponse<void>>}
283+
*/
284+
checkChangePasswordUsingJWTAndIPAddress(encodedJWT: string, ipAddress: string): Promise<ClientResponse<void>> {
285+
return this.startAnonymous<void, Errors>()
286+
.withUri('/api/user/change-password')
287+
.withAuthorization('Bearer ' + encodedJWT)
288+
.withParameter('ipAddress', ipAddress)
289+
.withMethod("GET")
290+
.go();
291+
}
292+
253293
/**
254294
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
255295
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -268,6 +308,26 @@ export class FusionAuthClient {
268308
.go();
269309
}
270310

311+
/**
312+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
313+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
314+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
315+
*
316+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
317+
*
318+
* @param {string} loginId The loginId (email or username) of the User that you intend to change the password for.
319+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
320+
* @returns {Promise<ClientResponse<void>>}
321+
*/
322+
checkChangePasswordUsingLoginIdAndIPAddress(loginId: string, ipAddress: string): Promise<ClientResponse<void>> {
323+
return this.start<void, Errors>()
324+
.withUri('/api/user/change-password')
325+
.withParameter('loginId', loginId)
326+
.withParameter('ipAddress', ipAddress)
327+
.withMethod("GET")
328+
.go();
329+
}
330+
271331
/**
272332
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
273333
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -288,6 +348,28 @@ export class FusionAuthClient {
288348
.go();
289349
}
290350

351+
/**
352+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
353+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
354+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
355+
*
356+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
357+
*
358+
* @param {string} loginId The loginId of the User that you intend to change the password for.
359+
* @param {Array<String>} loginIdTypes The identity types that FusionAuth will compare the loginId to.
360+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
361+
* @returns {Promise<ClientResponse<void>>}
362+
*/
363+
checkChangePasswordUsingLoginIdAndLoginIdTypesAndIPAddress(loginId: string, loginIdTypes: Array<String>, ipAddress: string): Promise<ClientResponse<void>> {
364+
return this.start<void, Errors>()
365+
.withUri('/api/user/change-password')
366+
.withParameter('loginId', loginId)
367+
.withParameter('loginIdTypes', loginIdTypes)
368+
.withParameter('ipAddress', ipAddress)
369+
.withMethod("GET")
370+
.go();
371+
}
372+
291373
/**
292374
* Make a Client Credentials grant request to obtain an access token.
293375
*
@@ -3853,6 +3935,24 @@ export class FusionAuthClient {
38533935
.go();
38543936
}
38553937

3938+
/**
3939+
* Retrieve a user's two-factor status.
3940+
*
3941+
* This can be used to see if a user will need to complete a two-factor challenge to complete a login,
3942+
* and optionally identify the state of the two-factor trust across various applications. This operation
3943+
* provides more payload options than retrieveTwoFactorStatus.
3944+
*
3945+
* @param {TwoFactorStatusRequest} request The request object that contains all the information used to check the status.
3946+
* @returns {Promise<ClientResponse<TwoFactorStatusResponse>>}
3947+
*/
3948+
retrieveTwoFactorStatusWithRequest(request: TwoFactorStatusRequest): Promise<ClientResponse<TwoFactorStatusResponse>> {
3949+
return this.start<TwoFactorStatusResponse, Errors>()
3950+
.withUri('/api/two-factor/status')
3951+
.withJSONBody(request)
3952+
.withMethod("POST")
3953+
.go();
3954+
}
3955+
38563956
/**
38573957
* Retrieves the user for the given Id.
38583958
*
@@ -5974,6 +6074,7 @@ export interface AuthenticationTokenConfiguration extends Enableable {
59746074
export interface LambdaConfiguration {
59756075
accessTokenPopulateId?: UUID;
59766076
idTokenPopulateId?: UUID;
6077+
multiFactorRequirementId?: UUID;
59776078
samlv2PopulateId?: UUID;
59786079
selfServiceRegistrationValidationId?: UUID;
59796080
userinfoPopulateId?: UUID;
@@ -6840,6 +6941,19 @@ export enum ContentStatus {
68406941
REJECTED = "REJECTED"
68416942
}
68426943

6944+
/**
6945+
* Represents the inbound lambda parameter 'context' for MFA Required lambdas.
6946+
*/
6947+
export interface Context {
6948+
accessToken?: string;
6949+
action?: MultiFactorAction;
6950+
application?: Application;
6951+
authenticationThreats?: Array<AuthenticationThreats>;
6952+
eventInfo?: EventInfo;
6953+
mfaTrust?: Trust;
6954+
policies?: Policies;
6955+
}
6956+
68436957
/**
68446958
* A number identifying a cryptographic algorithm. Values should be registered with the <a
68456959
* href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">IANA COSE Algorithms registry</a>
@@ -9085,7 +9199,8 @@ export enum LambdaType {
90859199
SCIMServerUserResponseConverter = "SCIMServerUserResponseConverter",
90869200
SelfServiceRegistrationValidation = "SelfServiceRegistrationValidation",
90879201
UserInfoPopulate = "UserInfoPopulate",
9088-
LoginValidation = "LoginValidation"
9202+
LoginValidation = "LoginValidation",
9203+
MFARequirement = "MFARequirement"
90899204
}
90909205

90919206
/**
@@ -9444,6 +9559,15 @@ export interface MonthlyActiveUserReportResponse {
94449559
total?: number;
94459560
}
94469561

9562+
/**
9563+
* Communicate various actions/contexts in which multi-factor authentication can be used.
9564+
*/
9565+
export enum MultiFactorAction {
9566+
changePassword = "changePassword",
9567+
login = "login",
9568+
stepUp = "stepUp"
9569+
}
9570+
94479571
/**
94489572
* @author Daniel DeGroff
94499573
*/
@@ -9889,6 +10013,15 @@ export interface PhoneUnverifiedOptions {
988910013
behavior?: UnverifiedBehavior;
989010014
}
989110015

10016+
/**
10017+
* Represents the inbound lambda parameter 'policies' for MFA Required lambdas.
10018+
*/
10019+
export interface Policies {
10020+
applicationLoginPolicy?: MultiFactorLoginPolicy;
10021+
applicationMultiFactorTrustPolicy?: ApplicationMultiFactorTrustPolicy;
10022+
tenantLoginPolicy?: MultiFactorLoginPolicy;
10023+
}
10024+
989210025
/**
989310026
* @author Michael Sleevi
989410027
*/
@@ -10119,6 +10252,7 @@ export interface ReactorStatus {
1011910252
expiration?: string;
1012010253
licenseAttributes?: Record<string, string>;
1012110254
licensed?: boolean;
10255+
multiFactorLambdas?: ReactorFeatureStatus;
1012210256
scimServer?: ReactorFeatureStatus;
1012310257
tenantManagerApplication?: ReactorFeatureStatus;
1012410258
threatDetection?: ReactorFeatureStatus;
@@ -10342,6 +10476,14 @@ export interface Requirable extends Enableable {
1034210476
required?: boolean;
1034310477
}
1034410478

10479+
/**
10480+
* Represents the inbound lambda parameter 'result' for MFA Required lambdas.
10481+
*/
10482+
export interface RequiredLambdaResult {
10483+
required?: boolean;
10484+
sendSuspiciousLoginEvent?: boolean;
10485+
}
10486+
1034510487
/**
1034610488
* Interface describing the need for CORS configuration.
1034710489
*
@@ -10894,6 +11036,7 @@ export interface TenantFormConfiguration {
1089411036
*/
1089511037
export interface TenantLambdaConfiguration {
1089611038
loginValidationId?: UUID;
11039+
multiFactorRequirementId?: UUID;
1089711040
scimEnterpriseUserRequestConverterId?: UUID;
1089811041
scimEnterpriseUserResponseConverterId?: UUID;
1089911042
scimGroupRequestConverterId?: UUID;
@@ -11295,6 +11438,26 @@ export enum TransactionType {
1129511438
AbsoluteMajority = "AbsoluteMajority"
1129611439
}
1129711440

11441+
/**
11442+
* Represents the inbound lambda parameter 'mfaTrust' inside the 'context' parameter for MFA Required lambdas.
11443+
*/
11444+
export interface Trust {
11445+
applicationId?: UUID;
11446+
attributes?: Record<string, string>;
11447+
expirationInstant?: number;
11448+
id?: string;
11449+
insertInstant?: number;
11450+
startInstants?: StartInstant;
11451+
state?: Record<string, any>;
11452+
tenantId?: UUID;
11453+
userId?: UUID;
11454+
}
11455+
11456+
export interface StartInstant {
11457+
applications?: Record<UUID, number>;
11458+
tenant?: number;
11459+
}
11460+
1129811461
/**
1129911462
* @author Brett Guy
1130011463
*/
@@ -11454,6 +11617,17 @@ export interface TwoFactorStartResponse {
1145411617
twoFactorId?: string;
1145511618
}
1145611619

11620+
/**
11621+
* Check the status of two-factor authentication for a user, with more options than on a GET request.
11622+
*/
11623+
export interface TwoFactorStatusRequest extends BaseEventRequest {
11624+
accessToken?: string;
11625+
action?: MultiFactorAction;
11626+
applicationId?: UUID;
11627+
twoFactorTrustId?: string;
11628+
userId?: UUID;
11629+
}
11630+
1145711631
/**
1145811632
* @author Daniel DeGroff
1145911633
*/

0 commit comments

Comments
 (0)