This optional parameter allows you to define a Perl function
that will be called during packet processing.
PreAuthHook
is called for each request after
per-Realm user name rewriting and before it is passed to any AuthBy
clauses. A reference to the current request is passed as the first
argument, and a reference to the reply packet currently being constructed
is passed as the second argument.
The hook code is compiled by Perl
when Radiator starts up. Compilation errors in your hook code will be
reported to the log file at start-up time. Runtime errors in your hook
will also be reported to the log file when your hook executes. Multiline
hooks (i.e. with trailing backslashes (\)) are parsed by Radiator into one
long line. Therefore you should not use trailing comments in your
hook.
PreAuthHook
can be an arbitrarily
complicated Perl function, that might run external processes, consult
databases, change the contents of the current request or many other
things.
# Fake a new attribute into the request
PreAuthHook sub { ${$_[0]}->add_attr('test-attr', \
'test-value');}