diff --git a/src/FusionAuthClient.ts b/src/FusionAuthClient.ts index eb8aee4..e51f999 100644 --- a/src/FusionAuthClient.ts +++ b/src/FusionAuthClient.ts @@ -232,6 +232,26 @@ export class FusionAuthClient { .go(); } + /** + * Check to see if the user must obtain a Trust Token Id in order to complete a change password request. + * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change + * your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication. + * + * 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. + * + * @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. + * @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment. + * @returns {Promise>} + */ + checkChangePasswordUsingIdAndIPAddress(changePasswordId: string, ipAddress: string): Promise> { + return this.startAnonymous() + .withUri('/api/user/change-password') + .withUriSegment(changePasswordId) + .withParameter('ipAddress', ipAddress) + .withMethod("GET") + .go(); + } + /** * Check to see if the user must obtain a Trust Token Id in order to complete a change password request. * 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 { .go(); } + /** + * Check to see if the user must obtain a Trust Token Id in order to complete a change password request. + * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change + * your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication. + * + * 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. + * + * @param {string} encodedJWT The encoded JWT (access token). + * @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment. + * @returns {Promise>} + */ + checkChangePasswordUsingJWTAndIPAddress(encodedJWT: string, ipAddress: string): Promise> { + return this.startAnonymous() + .withUri('/api/user/change-password') + .withAuthorization('Bearer ' + encodedJWT) + .withParameter('ipAddress', ipAddress) + .withMethod("GET") + .go(); + } + /** * Check to see if the user must obtain a Trust Request Id in order to complete a change password request. * 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 { .go(); } + /** + * Check to see if the user must obtain a Trust Request Id in order to complete a change password request. + * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change + * your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication. + * + * 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. + * + * @param {string} loginId The loginId (email or username) of the User that you intend to change the password for. + * @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment. + * @returns {Promise>} + */ + checkChangePasswordUsingLoginIdAndIPAddress(loginId: string, ipAddress: string): Promise> { + return this.start() + .withUri('/api/user/change-password') + .withParameter('loginId', loginId) + .withParameter('ipAddress', ipAddress) + .withMethod("GET") + .go(); + } + /** * Check to see if the user must obtain a Trust Request Id in order to complete a change password request. * 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 { .go(); } + /** + * Check to see if the user must obtain a Trust Request Id in order to complete a change password request. + * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change + * your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication. + * + * 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. + * + * @param {string} loginId The loginId of the User that you intend to change the password for. + * @param {Array} loginIdTypes The identity types that FusionAuth will compare the loginId to. + * @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment. + * @returns {Promise>} + */ + checkChangePasswordUsingLoginIdAndLoginIdTypesAndIPAddress(loginId: string, loginIdTypes: Array, ipAddress: string): Promise> { + return this.start() + .withUri('/api/user/change-password') + .withParameter('loginId', loginId) + .withParameter('loginIdTypes', loginIdTypes) + .withParameter('ipAddress', ipAddress) + .withMethod("GET") + .go(); + } + /** * Make a Client Credentials grant request to obtain an access token. *