Skip to content

Commit f7f47df

Browse files
authored
Merge feature/ENG-1111/mfa-lambda (#54)
* Merge wied03/ENG-3603/mfa-retrieve-status-post (#51) * client generation/new method * better method name * Merge wied03/ENG-3608/mfa-change-password (#53) * add IP address client overload * forgot to update method names * naming advice
1 parent e63ba65 commit f7f47df

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

lib/fusionauth/fusionauth_client.rb

Lines changed: 90 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
#
@@ -3352,6 +3426,22 @@ def retrieve_two_factor_status(user_id, application_id, two_factor_trust_id)
33523426
.go
33533427
end
33543428

3429+
#
3430+
# Retrieve a user's two-factor status.
3431+
#
3432+
# This can be used to see if a user will need to complete a two-factor challenge to complete a login,
3433+
# and optionally identify the state of the two-factor trust across various applications. This operation
3434+
# provides more payload options than retrieveTwoFactorStatus.
3435+
#
3436+
# @param request [OpenStruct, Hash] The request object that contains all the information used to check the status.
3437+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
3438+
def retrieve_two_factor_status_with_request(request)
3439+
start.uri('/api/two-factor/status')
3440+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
3441+
.post
3442+
.go
3443+
end
3444+
33553445
#
33563446
# Retrieves the user for the given Id.
33573447
#

0 commit comments

Comments
 (0)