IAM APIs needed to reset a user's password
search cancel

IAM APIs needed to reset a user's password

book

Article ID: 280218

calendar_today

Updated On: 02-27-2025

Products

Service Virtualization

Issue/Introduction

Identity Access Manager APIs used to reset a user's password.

Environment

All supported DevTest releases.

Resolution

The process to reset a current user password should be as follows:

1.  Get an access token by passing the client secret, which can be found in DEVTEST_HOME/IdentityAccessManager/realms-to-import/service_virtualization-realm.json
"clientId": "virtual-service-catalog",
"name": "virtual-service-catalog",
"description": "Virtual Service Catalog",
"clientAuthenticatorType": "client-secret",
"secret": "
<client-secret>"

Make note of the client-secret.


2.  Generate the Access token by running the following curl command:

Before DevTest 10.7.2 SP5:

curl -k -X POST -L 'https://localhost:51111/auth/realms/service_virtualization/protocol/openid-connect/token' -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=virtual-service-catalog' --data-urlencode 'client_secret=<client_secret>' --data-urlencode 'grant_type=client_credentials'

After DevTest 10.7.2 SP4:

curl -k -X POST -L 'https://localhost:51111/realms/service_virtualization/protocol/openid-connect/token' -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=virtual-service-catalog' --data-urlencode 'client_secret=<client_secret>' --data-urlencode 'grant_type=client_credentials'

Make note of the Access Token

3  Get the User ID for the user account you would like to reset by running the following curl command:

Before DevTest 10.7.2 SP5:

curl -k -L -X GET https://localhost:51111/auth/admin/realms/service_virtualization/users?username=<user>' -H 'Authorization: Bearer <access_token>'

After DevTest 10.7.2 SP4:

curl -k -L -X GET https://localhost:51111/admin/realms/service_virtualization/users?username=<user>' -H 'Authorization: Bearer <access_token>'

Make note of the user ID

4. Update/Reset the user password by running the following curl command:

Before DevTest 10.7.2 SP5:

 curl -k -L -X PUT 'https://localhost:51111/auth/admin/realms/service_virtualization/users/<user_id>/reset-password' -H 'Authorization: Bearer <access_token>' -H 'Content-Type: application/json' --data-raw '{"type":"password","value":"<newpassword>","temporary":false}' –insecure

After DevTest 10.7.2 SP4:

curl -k -L -X PUT 'https://localhost:51111/admin/realms/service_virtualization/users/<user_id>/reset-password' -H 'Authorization: Bearer <access_token>' -H 'Content-Type: application/json' --data-raw '{"type":"password","value":"<newpassword>","temporary":false}' –insecure

Additional Information

For more information see section "Using IAM API to Manage Users" in the DevTest documentation of the version you are running.