Skip to content

Commit 856a907

Browse files
authored
Merge feature/ENG-1111/mfa-lambda (#68)
* Merge wied03/ENG-3603/mfa-retrieve-status-post (#65) * client generation/new method * better method name * Merge wied03/ENG-3608/mfa-change-password (#67) * add IP address client overload * forgot to update method names * naming advice
1 parent f158650 commit 856a907

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

src/FusionAuth/FusionAuthClient.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,28 @@ public function checkChangePasswordUsingId($changePasswordId)
265265
->go();
266266
}
267267

268+
/**
269+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
270+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
271+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
272+
*
273+
* 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.
274+
*
275+
* @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.
276+
* @param string $ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
277+
*
278+
* @return ClientResponse The ClientResponse.
279+
* @throws \Exception
280+
*/
281+
public function checkChangePasswordUsingIdAndIPAddress($changePasswordId, $ipAddress = NULL)
282+
{
283+
return $this->startAnonymous()->uri("/api/user/change-password")
284+
->urlSegment($changePasswordId)
285+
->urlParameter("ipAddress", $ipAddress)
286+
->get()
287+
->go();
288+
}
289+
268290
/**
269291
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
270292
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -285,6 +307,28 @@ public function checkChangePasswordUsingJWT($encodedJWT)
285307
->go();
286308
}
287309

310+
/**
311+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
312+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
313+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
314+
*
315+
* 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.
316+
*
317+
* @param string $encodedJWT The encoded JWT (access token).
318+
* @param string $ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
319+
*
320+
* @return ClientResponse The ClientResponse.
321+
* @throws \Exception
322+
*/
323+
public function checkChangePasswordUsingJWTAndIPAddress($encodedJWT, $ipAddress = NULL)
324+
{
325+
return $this->startAnonymous()->uri("/api/user/change-password")
326+
->authorization("Bearer " . $encodedJWT)
327+
->urlParameter("ipAddress", $ipAddress)
328+
->get()
329+
->go();
330+
}
331+
288332
/**
289333
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
290334
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -305,6 +349,28 @@ public function checkChangePasswordUsingLoginId($loginId)
305349
->go();
306350
}
307351

352+
/**
353+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
354+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
355+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
356+
*
357+
* 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.
358+
*
359+
* @param string $loginId The loginId (email or username) of the User that you intend to change the password for.
360+
* @param string $ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
361+
*
362+
* @return ClientResponse The ClientResponse.
363+
* @throws \Exception
364+
*/
365+
public function checkChangePasswordUsingLoginIdAndIPAddress($loginId, $ipAddress = NULL)
366+
{
367+
return $this->start()->uri("/api/user/change-password")
368+
->urlParameter("loginId", $loginId)
369+
->urlParameter("ipAddress", $ipAddress)
370+
->get()
371+
->go();
372+
}
373+
308374
/**
309375
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
310376
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -327,6 +393,30 @@ public function checkChangePasswordUsingLoginIdAndLoginIdTypes($loginId, $loginI
327393
->go();
328394
}
329395

396+
/**
397+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
398+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
399+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
400+
*
401+
* 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.
402+
*
403+
* @param string $loginId The loginId of the User that you intend to change the password for.
404+
* @param array $loginIdTypes The identity types that FusionAuth will compare the loginId to.
405+
* @param string $ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
406+
*
407+
* @return ClientResponse The ClientResponse.
408+
* @throws \Exception
409+
*/
410+
public function checkChangePasswordUsingLoginIdAndLoginIdTypesAndIPAddress($loginId, $loginIdTypes, $ipAddress = NULL)
411+
{
412+
return $this->start()->uri("/api/user/change-password")
413+
->urlParameter("loginId", $loginId)
414+
->urlParameter("loginIdTypes", $loginIdTypes)
415+
->urlParameter("ipAddress", $ipAddress)
416+
->get()
417+
->go();
418+
}
419+
330420
/**
331421
* Make a Client Credentials grant request to obtain an access token.
332422
*
@@ -4346,6 +4436,26 @@ public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrust
43464436
->go();
43474437
}
43484438

4439+
/**
4440+
* Retrieve a user's two-factor status.
4441+
*
4442+
* This can be used to see if a user will need to complete a two-factor challenge to complete a login,
4443+
* and optionally identify the state of the two-factor trust across various applications. This operation
4444+
* provides more payload options than retrieveTwoFactorStatus.
4445+
*
4446+
* @param array $request The request object that contains all the information used to check the status.
4447+
*
4448+
* @return ClientResponse The ClientResponse.
4449+
* @throws \Exception
4450+
*/
4451+
public function retrieveTwoFactorStatusWithRequest($request)
4452+
{
4453+
return $this->start()->uri("/api/two-factor/status")
4454+
->bodyHandler(new JSONBodyHandler($request))
4455+
->post()
4456+
->go();
4457+
}
4458+
43494459
/**
43504460
* Retrieves the user for the given Id.
43514461
*

0 commit comments

Comments
 (0)