lib/fusionauth/fusionauth_client.rb in fusionauth_client-1.32.1 vs lib/fusionauth/fusionauth_client.rb in fusionauth_client-1.33.0

- old
+ new

@@ -96,10 +96,13 @@ end # # Changes a user's password using the change password Id. This usually occurs after an email has been sent to the user # and they clicked on a link to reset their password. + # + # As of version 1.32.2, prefer sending the changePasswordId in the request body. To do this, omit the first parameter, and set + # the value in the request body. # # @param change_password_id [string] The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated. # @param request [OpenStruct, Hash] The change password request that contains all of the information used to change the password. # @return [FusionAuth::ClientResponse] The ClientResponse object. def change_password(change_password_id, request) @@ -119,9 +122,57 @@ # @return [FusionAuth::ClientResponse] The ClientResponse object. def change_password_by_identity(request) start.uri('/api/user/change-password') .body_handler(FusionAuth::JSONBodyHandler.new(request)) .post() + .go() + end + + # + # 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 Truest Token by completing a Two-Factor Step-Up authentication. + # + # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API. + # + # @param change_password_id [string] The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def check_change_password_using_id(change_password_id) + startAnonymous.uri('/api/user/change-password') + .url_segment(change_password_id) + .get() + .go() + end + + # + # 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 Truest Token by completing a Two-Factor Step-Up authentication. + # + # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API. + # + # @param encoded_jwt [string] The encoded JWT (access token). + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def check_change_password_using_jwt(encoded_jwt) + startAnonymous.uri('/api/user/change-password') + .authorization('Bearer ' + encoded_jwt) + .get() + .go() + end + + # + # 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 Truest Request Id by completing a Two-Factor Step-Up authentication. + # + # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API. + # + # @param login_id [string] The loginId of the User that you intend to change the password for. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def check_change_password_using_login_id(login_id) + start.uri('/api/user/change-password') + .url_parameter('username', login_id) + .get() .go() end # # Adds a comment to the user's account.