Change users status from active to inactive in Openam

411 Views Asked by At

I am not able to find any docs to change user's status to switch between active or inactive status in Openam 13 programmatically. Is there any API exposed to do so?

1

There are 1 best solutions below

0
On

There is a REST API where you can change user status from Active to Inactive.

Authenticate as an admin user; you must use the actual AM server URL

$ curl -X POST -H "X-OpenAM-Username: amadmin" -H "X-OpenAM-Password: cangetinam" -H "Content-Type: application/json" http://host1.example.com:8080/openam/json/authenticate

Example response

{ "tokenId": "AQIC5wM2LY4SfcxsuvGEjcsppDSFR8H8DYBSouTtz3m64PI.*AAJTSQACMDIAAlNLABQtNTQwMTU3NzgxODI0NzE3OTIwNAEwNDU2NjE0*", "successUrl": "/openam/console", "realm": "/" } 

Active/Inactive user account status(in this example, demo )where the iPlanetDirectoryPro header (default AM session cookie name) is set to the token returned when you authenticated:

$ curl -X PUT -H "iPlanetDirectoryPro: AQIC5wM2LY4Sfcxs...EwNDU2NjE0*" -H "Content-type: application/json" -d'{
    "inetUserStatus": "Active"
}' http://host1.example.com:8080/openam/json/users/demo

The response should have user whole hierarchy.