Passing data to custom xlat function

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Fri Aug 27 22:36:23 CEST 2021


Hi there,

I wonder if there is a way to "transport" data to an xlat function on
another way than attaching it to a Radius request...

I'm asking this because we have quite a lot of parameters that we want
to be expanded in the module config file.

These parameters depend on the user realm. So when a request comes in,
our module does a look up in a realm to connection data table. This
connection data again is used to make a REST authentication.

In the module config we have something like this:

uri = "https://%{control:Cust-Gateway}/api/%{control:Cust-App-Id}/etc/..."
data =
'grant_type=password&username=%{urlquote:%{control:Cust-Client-Id}}&password=%{urlquote:%{control:Cust-Client-Secret}}'

In the authorize function we do the DB call and when the realm is valid
we add these custom attributes to the request.

This works, but maybe there's a more elegant way than adding attributes
to the request only for xla expansion.

The xlat callback function has only a handle to the instance
configuration. I don't see a way to store the data-by-realm there. Of
course we could do a data lookup in the xlat callback, but I don't like
this approach because this would result in two DB calls per request.

Cheers,
Till





More information about the Freeradius-Users mailing list