[RADIATOR] (no subject)
Heikki Vatiainen
hvn at open.com.au
Mon May 22 21:19:52 UTC 2023
On 22.5.2023 9.37, Greg Haverkamp via radiator wrote:
> I'm attempting to call a fairly simple (but non-modifiable) restful
> API by means of AuthBy REST, and I cannot seem to make sense of how I
> should act upon the response it gives.
>
> I get a JSON response that looks something like this:
> {
> "version": "LinOTP 2.11.2",
> "jsonrpc": "2.0802",
> "result": {
> "status": true,
> "value": false
> },
> "id": 0
> }
>
I can create an example of how to access the contents of the "result"
key. The default is to create a Perl hash for the keys but more complex
structures require more configuration.
> I've also been trying MapResponseHook, but the documentation on that
> is, shall we say, spartan. I just figured it might get the server
> response into a place where I could access it via AuthBy internal or a
> post auth hook, maybe that's what's required.
>
> Does someone have an example of how to use this with JSON going back
> in response?
The MapResponseHook would be the tool here, and as you kindly put it, it
needs a better example of how to process responses like the one above. I
think there are at least two options here: use "status" and/or "value"
directly to trigger a reject or reply, or then save their values so that
they can be processed later. For example, for a hook or another AuthBy
you've mentioned above.
I'll get back to this.
Heikki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.open.com.au/pipermail/radiator/attachments/20230523/30f4723b/attachment.html>
More information about the radiator
mailing list