Skip to content

Commit b76d42b

Browse files
authored
Merge wied03/ENG-3608/mfa-change-password (#53)
* add IP address client overload * forgot to update method names
1 parent 57f2173 commit b76d42b

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

lib/fusionauth/fusionauth_client.rb

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,24 @@ def check_change_password_using_id(change_password_id)
199199
.go
200200
end
201201

202+
#
203+
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
204+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
205+
# your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
206+
#
207+
# 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.
208+
#
209+
# @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.
210+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
211+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
212+
def check_change_password_using_id_and_ip_address(change_password_id, ip_address)
213+
startAnonymous.uri('/api/user/change-password')
214+
.url_segment(change_password_id)
215+
.url_parameter('ipAddress', ip_address)
216+
.get
217+
.go
218+
end
219+
202220
#
203221
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
204222
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -215,6 +233,24 @@ def check_change_password_using_jwt(encoded_jwt)
215233
.go
216234
end
217235

236+
#
237+
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
238+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
239+
# your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
240+
#
241+
# 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.
242+
#
243+
# @param encoded_jwt [string] The encoded JWT (access token).
244+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
245+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
246+
def check_change_password_using_jwt_and_ip_address(encoded_jwt, ip_address)
247+
startAnonymous.uri('/api/user/change-password')
248+
.authorization('Bearer ' + encoded_jwt)
249+
.url_parameter('ipAddress', ip_address)
250+
.get
251+
.go
252+
end
253+
218254
#
219255
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
220256
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -231,6 +267,24 @@ def check_change_password_using_login_id(login_id)
231267
.go
232268
end
233269

270+
#
271+
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
272+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
273+
# your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
274+
#
275+
# 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.
276+
#
277+
# @param login_id [string] The loginId (email or username) of the User that you intend to change the password for.
278+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
279+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
280+
def check_change_password_using_login_id_and_ip_address(login_id, ip_address)
281+
start.uri('/api/user/change-password')
282+
.url_parameter('loginId', login_id)
283+
.url_parameter('ipAddress', ip_address)
284+
.get
285+
.go
286+
end
287+
234288
#
235289
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
236290
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -249,6 +303,26 @@ def check_change_password_using_login_id_and_login_id_types(login_id, login_id_t
249303
.go
250304
end
251305

306+
#
307+
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
308+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
309+
# your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
310+
#
311+
# 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.
312+
#
313+
# @param login_id [string] The loginId of the User that you intend to change the password for.
314+
# @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
315+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
316+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
317+
def check_change_password_using_login_id_and_login_id_types_and_ip_address(login_id, login_id_types, ip_address)
318+
start.uri('/api/user/change-password')
319+
.url_parameter('loginId', login_id)
320+
.url_parameter('loginIdTypes', login_id_types)
321+
.url_parameter('ipAddress', ip_address)
322+
.get
323+
.go
324+
end
325+
252326
#
253327
# Make a Client Credentials grant request to obtain an access token.
254328
#

0 commit comments

Comments
 (0)