rlm_rest: Parsing the response attributes

Nick Porter nick at portercomputing.co.uk
Wed Jul 24 10:38:25 UTC 2024


On 24/07/2024 06:49, Michael Schwartzkopff via Freeradius-Users wrote:
>
> rest: Failed parsing attribute: Invalid vendor name in attribute name 
> "count", skipping

FreeRADIUS version 3 expects that JSON responses will match one of a 
number of defined formats:


{
     "<attribute0>":{
         "do_xlat":<bool>,
         "is_json":<bool>,
         "op":"<operator>",
         "value":[<value0>,<value1>,<valueN>]
     },
     "<attribute1>":{
         "value":{
             "<nested-attribute0>":{
                 "op":"<operator>",
                 "value":<value0>
             }
         }
     },
     "<attribute2>":"<value0>",
  "<attributeN>":[<value0>,<value1>,<valueN>]
}


Your sample data most closely matches the example "attribute2" in the 
format - so FreeRADIUS is looking to populate an attribute "count" with 
the provided value, but that does not exist in the dictionary.

You could define local attributes matching the names found in your JSON 
responses, which will then be populated with the data in the response.

It will be important to define all the possible objects which will be 
returned even if they are not used.


FreeRADIUS v4 will make this much easier with the "json map" construct 
which allows arbitrary objects from a json structure to be used in 
populating attributes.


-- 
Nick Porter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20240724/1c05c222/attachment-0001.sig>


More information about the Freeradius-Users mailing list