Invalidate all sessions for a given user
To log out all sessions for a given user, first obtain a list of session handles of their active sessions,
by performing an HTTP GET to the /json/sessions/
endpoint, using the SSO token of
an administrative user, such as amAdmin
as the value of the iPlanetDirectoryPro
header.
You must also specify a queryFilter
parameter.
The queryFilter
parameter requires the name of the user, and the realm to search.
For example, to obtain a list of session handles for a user named demo
in the alpha
realm,
the query filter value would be:
username eq "demo" and realm eq "/alpha"
The query filter value must be URL encoded when sent over HTTP. For more information on query filter parameters, see Query. |
In the following example, there is one active session:
$ [${resources.dir}/endpoints/sessions.bash:#POST-sessions-logout-handle-query]
[${resources.dir}/endpoints/sessions.bash:#POST-sessions-logout-handle-query-expected]
To log out all sessions for the specific user, perform an HTTP POST to the /json/sessions/
endpoint,
using the SSO token of an administrative user, such as amAdmin
, as the value of the iPlanetDirectoryPro
header.
You must also specify the logoutByHandle
action,
and include an array of the session handles to invalidate in the POST body,
in a property named sessionHandles
, as shown below:
$ [${resources.dir}/endpoints/sessions.bash:#POST-sessions-logout-handle]
[${resources.dir}/endpoints/sessions.bash:#POST-sessions-logout-handle-expected]