PUT http://localhost:8080/midpoint/ws/rest/users/{oid}/policy
User Specific Operations
Description
A set of operations which are specific for objects of the "User" type residing on the "users" endpoint.
Request
The methods which are used in the requests are HTTP GET and HTTP POST. The usage depends on the type of the operation which you are about to invoke. Base on this there are two specific operations for the users endpoint. Each request should contain the {oid} of a specific object for which you invoke the operation and an operation notation (e.g. "credentials")
Using the GET method, you can invoke an operation which produces the value policy which is used on the User type object.
POST can be used for a credentials reset, for a specific user. This operation has to also contain a "ExecuteCredentialResetRequestType" objen in the request body.
POST http://localhost:8080/midpoint/ws/rest/users/{oid}/credential
Headers
Regarding authorization type, the "Basic" Authorization header should be used.
Authorization: Basic {Base64EncodedCredentials}
To specify the provided content type, please use the "Content-Type" header payload in the body:
"Content-Type: application/json"
You might need to specify the accepted type of content in case you are interested in a format different from xml (default):
"Accept: application/json"
Body
In case of the "Reset credentials" operation, the body should contain a payload consisting of a ExecuteCredentialResetRequestType type of object. Please see the examples below for an example of such object.
Options
No operation options supported for this set of requests.
Response
Error code | Meaning |
---|---|
1xx |
Information. Stay tuned, operation is in progress. |
2xx |
Success. Operation finished successfully. There are two custom codes:
In this two cases, midPoint returns the OperationResult where there details of executed operations can be found. |
3xx |
Redirection or "in progress". This is returned mostly to indicate two cases:
|
4xx |
Client errors. The client has sent request that cannot be processed. This indicates usual situation that are well handled by the midPoint code. Maybe the client request to create conflicting object, delete non-existent object, modification that violates the schema and so on. The OperationResult structure is usually provided in the response to provide more details about the situation. |
5xx |
Server errors. Situations that the server cannot handle and where the cause is unknown. This usually means bugs in the code, insufficient resources such as RAM or disk space, unforeseen failures in the infrastructure and so on. The OperationResult structure might or might not be provided in this case. Some errors are so severe that the structured error information might not be available. |
Status codes and the indication of errors and asynchronous processing applies uniformly to all midPoint web resources (both RESTful and RPC).
Access Authorization
The interface authorization needed for executing this type of request. The authorization is needed to access the specific part of the interface. For more information please see this page.
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-rest-3#resetCredential
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-rest-3#getValuePolicy
Model Authorization
The model authorization for the specific action. This authorization is needed to request/execute the concrete action. The examples are usually quite broad, and the actions can be additionally specified for a more fine-grained authorization. For more information please see this page.
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#rawOperation
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#get
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#read
For the "Reset Credentials" operation also additionally add use the following:
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#modify
Examples
In our examples we are authenticating with the credentials, name "administrator" and password "y0uR_P455woR*d" on a localhost instance running on port 8080. |
For some help regarding the REST examples please see this link:
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-X GET http://localhost:8080/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002/policy \
-v
The response is an HTTP 200 code in case of success with a response body containing the queried item.
Example Output of "Get Users Value Policy" example
{
"@ns" : "http://prism.evolveum.com/xml/ns/public/types-3",
"object" : {
"@type" : "c:CredentialsPolicyType",
"password" : {
"minOccurs" : "0",
"lockoutMaxFailedAttempts" : 3,
"lockoutFailedAttemptsDuration" : "PT3M",
"lockoutDuration" : "PT15M",
"valuePolicyRef" : {
"oid" : "00000000-0000-0000-0000-000000000003",
"relation" : "org:default",
"type" : "c:ValuePolicyType",
"targetName" : "Default Password Policy"
}
}
}
}
Please see note:
This example also needs a configuration change in the system global security policy. You have to enable the password reset feature in you configuration, please see this page. |
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/users/e297a878-89da-43fa-b67a-d0316975388a/credential \
-v \
--data-binary @./samples/rest/user-pwd-reset.json
Show data source example for "Execute password reset by administrator for user" | GitHub
{
"executeCredentialResetRequest": {
"resetMethod": "passwordReset",
"userEntry": "5ecr3tP4s5w0rd"
}
}
The response is an HTTP 200 code in case of success with a response body.
Show example output for "Execute password reset by administrator for user"
{
"@ns" : "http://prism.evolveum.com/xml/ns/public/types-3",
"object" : {
"@type" : "http://midpoint.evolveum.com/xml/ns/public/common/api-types-3#ExecuteCredentialResetResponseType",
"message" : {
"@type" : "c:SingleLocalizableMessageType",
"key" : "execute.reset.credential.successful",
"fallbackMessage" : "Reset password was successful"
}
}
}