3.74.5. NtlmRewriteHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function to rewrite the username that is passed to ntlm_auth. Username passed to ntlm_auth is changed to whatever is returned by this function. The username in request is not changed. This may be needed, for example, with Wi-Fi roaming where roaming username can not be directly used with Windows authentication because of local naming conflicts with roaming requirements.
The following parameters are passed to NtlmRewriteHook:
  • $_[0]: $p, the current Radius::Radius request object
  • $_[1]: $user, the current username to pass to ntlm_auth
Here are some examples:
# We use file instead of inline code
NtlmRewriteHook file:"%D/ntlm-rewrite-hook.pl"
# Use inline code to change our global roaming realm to windows domain
NtlmRewriteHook sub { my ($user) = $_[1]; \
    $user =~ s/example\.com\z/org.local/; \
    return $user; }