Skip to content

Commit 2a65463

Browse files
authored
Merge pull request #59 from FusionAuth/wied03/ENG-2750/develop_merge_org_admin
Merge wied03/ENG-2750/develop_merge_org_admin
2 parents 7f1f69d + a944e19 commit 2a65463

File tree

2 files changed

+72
-50
lines changed

2 files changed

+72
-50
lines changed

build.savant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* language governing permissions and limitations under the License.
1515
*/
1616

17-
project(group: "io.fusionauth", name: "fusionauth-php-client", version: "1.58.0", licenses: ["ApacheV2_0"]) {
17+
project(group: "io.fusionauth", name: "fusionauth-php-client", version: "1.59.0", licenses: ["ApacheV2_0"]) {
1818
workflow {
1919
fetch {
2020
cache()

src/FusionAuth/FusionAuthClient.php

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
namespace FusionAuth;
33

44
/*
5-
* Copyright (c) 2018-2023, FusionAuth, All Rights Reserved
5+
* Copyright (c) 2018-2025, FusionAuth, All Rights Reserved
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -195,6 +195,7 @@ public function changePassword($changePasswordId, $request)
195195
*
196196
* @return ClientResponse The ClientResponse.
197197
* @throws \Exception
198+
* @deprecated This method has been renamed to changePasswordUsingJWT, use that method instead.
198199
*/
199200
public function changePasswordByJWT($encodedJWT, $request)
200201
{
@@ -223,6 +224,27 @@ public function changePasswordByIdentity($request)
223224
->go();
224225
}
225226

227+
/**
228+
* Changes a user's password using their access token (JWT) instead of the changePasswordId
229+
* A common use case for this method will be if you want to allow the user to change their own password.
230+
*
231+
* Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
232+
*
233+
* @param string $encodedJWT The encoded JWT (access token).
234+
* @param array $request The change password request that contains all the information used to change the password.
235+
*
236+
* @return ClientResponse The ClientResponse.
237+
* @throws \Exception
238+
*/
239+
public function changePasswordUsingJWT($encodedJWT, $request)
240+
{
241+
return $this->startAnonymous()->uri("/api/user/change-password")
242+
->authorization("Bearer " . $encodedJWT)
243+
->bodyHandler(new JSONBodyHandler($request))
244+
->post()
245+
->go();
246+
}
247+
226248
/**
227249
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
228250
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -989,7 +1011,7 @@ public function deactivateUserAction($userActionId)
9891011
}
9901012

9911013
/**
992-
* Deactivates the users with the given ids.
1014+
* Deactivates the users with the given Ids.
9931015
*
9941016
* @param array $userIds The ids of the users to deactivate.
9951017
*
@@ -1008,7 +1030,7 @@ public function deactivateUsers($userIds)
10081030
}
10091031

10101032
/**
1011-
* Deactivates the users with the given ids.
1033+
* Deactivates the users with the given Ids.
10121034
*
10131035
* @param array $userIds The ids of the users to deactivate.
10141036
*
@@ -1582,8 +1604,8 @@ public function deleteUserWithRequest($userId, $request)
15821604
}
15831605

15841606
/**
1585-
* Deletes the users with the given ids, or users matching the provided JSON query or queryString.
1586-
* The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.
1607+
* Deletes the users with the given Ids, or users matching the provided JSON query or queryString.
1608+
* The order of preference is Ids, query and then queryString, it is recommended to only provide one of the three for the request.
15871609
*
15881610
* This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
15891611
* Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -1603,8 +1625,8 @@ public function deleteUsers($request)
16031625
}
16041626

16051627
/**
1606-
* Deletes the users with the given ids, or users matching the provided JSON query or queryString.
1607-
* The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.
1628+
* Deletes the users with the given Ids, or users matching the provided JSON query or queryString.
1629+
* The order of preference is Ids, query and then queryString, it is recommended to only provide one of the three for the request.
16081630
*
16091631
* This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
16101632
* Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -2253,7 +2275,7 @@ public function lookupIdentityProvider($domain)
22532275
* Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the
22542276
* action.
22552277
*
2256-
* @param string $actionId The Id of the action to modify. This is technically the user action log id.
2278+
* @param string $actionId The Id of the action to modify. This is technically the user action log Id.
22572279
* @param array $request The request that contains all the information about the modification.
22582280
*
22592281
* @return ClientResponse The ClientResponse.
@@ -2285,10 +2307,10 @@ public function passwordlessLogin($request)
22852307
}
22862308

22872309
/**
2288-
* Updates an authentication API key by given id
2310+
* Updates an API key with the given Id.
22892311
*
2290-
* @param string $keyId The Id of the authentication key. If not provided a secure random api key will be generated.
2291-
* @param array $request The request object that contains all the information needed to create the APIKey.
2312+
* @param string $keyId The Id of the API key. If not provided a secure random api key will be generated.
2313+
* @param array $request The request object that contains all the information needed to create the API key.
22922314
*
22932315
* @return ClientResponse The ClientResponse.
22942316
* @throws \Exception
@@ -2298,7 +2320,7 @@ public function patchAPIKey($keyId, $request)
22982320
return $this->start()->uri("/api/api-key")
22992321
->urlSegment($keyId)
23002322
->bodyHandler(new JSONBodyHandler($request))
2301-
->post()
2323+
->patch()
23022324
->go();
23032325
}
23042326

@@ -2951,7 +2973,7 @@ public function reindex($request)
29512973
}
29522974

29532975
/**
2954-
* Removes a user from the family with the given id.
2976+
* Removes a user from the family with the given Id.
29552977
*
29562978
* @param string $familyId The Id of the family to remove the user from.
29572979
* @param string $userId The Id of the user to remove from the family.
@@ -3022,7 +3044,7 @@ public function resendRegistrationVerification($email, $applicationId)
30223044
}
30233045

30243046
/**
3025-
* Retrieves an authentication API key for the given id
3047+
* Retrieves an authentication API key for the given Id.
30263048
*
30273049
* @param string $keyId The Id of the API key to retrieve.
30283050
*
@@ -3108,7 +3130,7 @@ public function retrieveActiveActions($userId)
31083130
/**
31093131
* Retrieves the application for the given Id or all the applications if the Id is null.
31103132
*
3111-
* @param string $applicationId (Optional) The application id.
3133+
* @param string $applicationId (Optional) The application Id.
31123134
*
31133135
* @return ClientResponse The ClientResponse.
31143136
* @throws \Exception
@@ -3212,10 +3234,10 @@ public function retrieveConsents()
32123234
}
32133235

32143236
/**
3215-
* Retrieves the daily active user report between the two instants. If you specify an application id, it will only
3237+
* Retrieves the daily active user report between the two instants. If you specify an application Id, it will only
32163238
* return the daily active counts for that application.
32173239
*
3218-
* @param string $applicationId (Optional) The application id.
3240+
* @param string $applicationId (Optional) The application Id.
32193241
* @param array $start The start instant as UTC milliseconds since Epoch.
32203242
* @param array $end The end instant as UTC milliseconds since Epoch.
32213243
*
@@ -3233,7 +3255,7 @@ public function retrieveDailyActiveReport($applicationId, $start, $end)
32333255
}
32343256

32353257
/**
3236-
* Retrieves the email template for the given Id. If you don't specify the id, this will return all the email templates.
3258+
* Retrieves the email template for the given Id. If you don't specify the Id, this will return all the email templates.
32373259
*
32383260
* @param string $emailTemplateId (Optional) The Id of the email template.
32393261
*
@@ -3748,10 +3770,10 @@ public function retrieveLambdasByType($type)
37483770
}
37493771

37503772
/**
3751-
* Retrieves the login report between the two instants. If you specify an application id, it will only return the
3773+
* Retrieves the login report between the two instants. If you specify an application Id, it will only return the
37523774
* login counts for that application.
37533775
*
3754-
* @param string $applicationId (Optional) The application id.
3776+
* @param string $applicationId (Optional) The application Id.
37553777
* @param array $start The start instant as UTC milliseconds since Epoch.
37563778
* @param array $end The end instant as UTC milliseconds since Epoch.
37573779
*
@@ -3769,7 +3791,7 @@ public function retrieveLoginReport($applicationId, $start, $end)
37693791
}
37703792

37713793
/**
3772-
* Retrieves the message template for the given Id. If you don't specify the id, this will return all the message templates.
3794+
* Retrieves the message template for the given Id. If you don't specify the Id, this will return all the message templates.
37733795
*
37743796
* @param string $messageTemplateId (Optional) The Id of the message template.
37753797
*
@@ -3845,10 +3867,10 @@ public function retrieveMessengers()
38453867
}
38463868

38473869
/**
3848-
* Retrieves the monthly active user report between the two instants. If you specify an application id, it will only
3870+
* Retrieves the monthly active user report between the two instants. If you specify an application Id, it will only
38493871
* return the monthly active counts for that application.
38503872
*
3851-
* @param string $applicationId (Optional) The application id.
3873+
* @param string $applicationId (Optional) The application Id.
38523874
* @param array $start The start instant as UTC milliseconds since Epoch.
38533875
* @param array $end The end instant as UTC milliseconds since Epoch.
38543876
*
@@ -4063,7 +4085,7 @@ public function retrieveRefreshTokens($userId)
40634085
}
40644086

40654087
/**
4066-
* Retrieves the user registration for the user with the given Id and the given application id.
4088+
* Retrieves the user registration for the user with the given Id and the given application Id.
40674089
*
40684090
* @param string $userId The Id of the user.
40694091
* @param string $applicationId The Id of the application.
@@ -4081,10 +4103,10 @@ public function retrieveRegistration($userId, $applicationId)
40814103
}
40824104

40834105
/**
4084-
* Retrieves the registration report between the two instants. If you specify an application id, it will only return
4106+
* Retrieves the registration report between the two instants. If you specify an application Id, it will only return
40854107
* the registration counts for that application.
40864108
*
4087-
* @param string $applicationId (Optional) The application id.
4109+
* @param string $applicationId (Optional) The application Id.
40884110
* @param array $start The start instant as UTC milliseconds since Epoch.
40894111
* @param array $end The end instant as UTC milliseconds since Epoch.
40904112
*
@@ -4303,7 +4325,7 @@ public function retrieveUser($userId)
43034325
}
43044326

43054327
/**
4306-
* Retrieves the user action for the given Id. If you pass in null for the id, this will return all the user
4328+
* Retrieves the user action for the given Id. If you pass in null for the Id, this will return all the user
43074329
* actions.
43084330
*
43094331
* @param string $userActionId (Optional) The Id of the user action.
@@ -4320,7 +4342,7 @@ public function retrieveUserAction($userActionId = NULL)
43204342
}
43214343

43224344
/**
4323-
* Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all the user
4345+
* Retrieves the user action reason for the given Id. If you pass in null for the Id, this will return all the user
43244346
* action reasons.
43254347
*
43264348
* @param string $userActionReasonId (Optional) The Id of the user action reason.
@@ -4469,8 +4491,8 @@ public function retrieveUserByVerificationId($verificationId)
44694491
*
44704492
* This API is useful if you want to build your own login workflow to complete a device grant.
44714493
*
4472-
* @param string $client_id The client id.
4473-
* @param string $client_secret The client id.
4494+
* @param string $client_id The client Id.
4495+
* @param string $client_secret The client Id.
44744496
* @param string $user_code The end-user verification code.
44754497
*
44764498
* @return ClientResponse The ClientResponse.
@@ -4615,11 +4637,11 @@ public function retrieveUserLinksByUserId($identityProviderId, $userId)
46154637
}
46164638

46174639
/**
4618-
* Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the
4640+
* Retrieves the login report between the two instants for a particular user by Id. If you specify an application Id, it will only return the
46194641
* login counts for that application.
46204642
*
4621-
* @param string $applicationId (Optional) The application id.
4622-
* @param string $userId The userId id.
4643+
* @param string $applicationId (Optional) The application Id.
4644+
* @param string $userId The userId Id.
46234645
* @param array $start The start instant as UTC milliseconds since Epoch.
46244646
* @param array $end The end instant as UTC milliseconds since Epoch.
46254647
*
@@ -4638,11 +4660,11 @@ public function retrieveUserLoginReport($applicationId, $userId, $start, $end)
46384660
}
46394661

46404662
/**
4641-
* Retrieves the login report between the two instants for a particular user by login Id. If you specify an application id, it will only return the
4663+
* Retrieves the login report between the two instants for a particular user by login Id. If you specify an application Id, it will only return the
46424664
* login counts for that application.
46434665
*
4644-
* @param string $applicationId (Optional) The application id.
4645-
* @param string $loginId The userId id.
4666+
* @param string $applicationId (Optional) The application Id.
4667+
* @param string $loginId The userId Id.
46464668
* @param array $start The start instant as UTC milliseconds since Epoch.
46474669
* @param array $end The end instant as UTC milliseconds since Epoch.
46484670
*
@@ -4768,7 +4790,7 @@ public function retrieveWebAuthnCredentialsForUser($userId)
47684790
}
47694791

47704792
/**
4771-
* Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks.
4793+
* Retrieves the webhook for the given Id. If you pass in null for the Id, this will return all the webhooks.
47724794
*
47734795
* @param string $webhookId (Optional) The Id of the webhook.
47744796
*
@@ -5068,7 +5090,7 @@ public function searchEntities($request)
50685090
}
50695091

50705092
/**
5071-
* Retrieves the entities for the given ids. If any Id is invalid, it is ignored.
5093+
* Retrieves the entities for the given Ids. If any Id is invalid, it is ignored.
50725094
*
50735095
* @param array $ids The entity ids to search for.
50745096
*
@@ -5292,7 +5314,7 @@ public function searchUserComments($request)
52925314
}
52935315

52945316
/**
5295-
* Retrieves the users for the given ids. If any Id is invalid, it is ignored.
5317+
* Retrieves the users for the given Ids. If any Id is invalid, it is ignored.
52965318
*
52975319
* @param array $ids The user ids to search for.
52985320
*
@@ -5309,9 +5331,9 @@ public function searchUsers($ids)
53095331
}
53105332

53115333
/**
5312-
* Retrieves the users for the given ids. If any Id is invalid, it is ignored.
5334+
* Retrieves the users for the given Ids. If any Id is invalid, it is ignored.
53135335
*
5314-
* @param array $ids The user ids to search for.
5336+
* @param array $ids The user Ids to search for.
53155337
*
53165338
* @return ClientResponse The ClientResponse.
53175339
* @throws \Exception
@@ -5392,7 +5414,7 @@ public function searchWebhooks($request)
53925414
}
53935415

53945416
/**
5395-
* Send an email using an email template id. You can optionally provide <code>requestData</code> to access key value
5417+
* Send an email using an email template Id. You can optionally provide <code>requestData</code> to access key value
53965418
* pairs in the email template.
53975419
*
53985420
* @param string $emailTemplateId The Id for the template.
@@ -5647,18 +5669,18 @@ public function twoFactorLogin($request)
56475669
}
56485670

56495671
/**
5650-
* Updates an API key by given id
5672+
* Updates an API key with the given Id.
56515673
*
5652-
* @param string $apiKeyId The Id of the API key to update.
5653-
* @param array $request The request object that contains all the information used to create the API Key.
5674+
* @param string $keyId The Id of the API key to update.
5675+
* @param array $request The request that contains all the new API key information.
56545676
*
56555677
* @return ClientResponse The ClientResponse.
56565678
* @throws \Exception
56575679
*/
5658-
public function updateAPIKey($apiKeyId, $request)
5680+
public function updateAPIKey($keyId, $request)
56595681
{
56605682
return $this->start()->uri("/api/api-key")
5661-
->urlSegment($apiKeyId)
5683+
->urlSegment($keyId)
56625684
->bodyHandler(new JSONBodyHandler($request))
56635685
->put()
56645686
->go();
@@ -6231,7 +6253,7 @@ public function upsertEntityGrant($entityId, $request)
62316253
* If you build your own activation form you should validate the user provided code prior to beginning the Authorization grant.
62326254
*
62336255
* @param string $user_code The end-user verification code.
6234-
* @param string $client_id The client id.
6256+
* @param string $client_id The client Id.
62356257
*
62366258
* @return ClientResponse The ClientResponse.
62376259
* @throws \Exception
@@ -6416,4 +6438,4 @@ private function startAnonymous()
64166438
->successResponseHandler(new JSONResponseHandler())
64176439
->errorResponseHandler(new JSONResponseHandler());
64186440
}
6419-
}
6441+
}

0 commit comments

Comments
 (0)