7.6.7. ResponseMangler Handler Module¶
The ResponseMangler is a special handler module, that can modify the response of an HTTP request. This way privacyIDEA can change the data sent back to the client, depending on certain conditions.
All actions take a JSON pointer, which looks like a path variable like
220.127.116.11. Possible Actions¶
This action simply deletes the given JSON pointer from the response.
All keys underneath a node are deleted, to. So if the event handler
/detail, the entries
/detail/message and ``/detail/error``will
also be deleted.
You can use this to delete
/token/init event to hide the created QR code from the helpdesk admin.
This way the QR code could be used internally, but could be hidden from
This action is used to add additional pointers to the JSON response or to modify existing entries. Existing entries are overwritten.
This action takes the additional attributes
The value can be returned as a string, an integer or a boolean.
This is the event handler module that can mangle the JSON response. We can add or delete key or even subtrees in the JSON response of a request.
The key is identified by a JSON Pointer (see https://tools.ietf.org/html/rfc6901)
An Eventhandler needs to return a list of actions, which it can handle.
It also returns a list of allowed action and conditions
It returns an identifier, which can be used in the eventhandlig definitions
This method returns a dictionary of allowed actions and possible options in this handler module.
dict with actions
This returns the allowed positions of the event handler definition. The ResponseMangler can only be located at the “post” position
list of allowed positions
description= 'This event handler can mangle the JSON response.'¶
This method executes the defined action in the given event.
options (dict) – Contains the flask parameters g, request, response and the handler_def configuration