3.5.27. RewriteUsername Previous topic Parent topic Child topic Next topic

This parameter enables you to alter the User-Name in authentication and accounting requests. For more details, see Section 8. Rewriting user names. You can also rewrite user names on a per-Client or per-Handler basis. For more information, see and Section 3.11.9. RewriteUsername and Section 3.25.1. RewriteUsername.
You can have any number of RewriteUsername parameters. The rewrites will be applied to the user name in the same order that they appear in the configuration file. The rewrites are applied before any per-Client or per-Realm rewrites. At Trace level 4, you can see the result of each separate rewrite for debugging purposes.
# Convert all user@realm1 to user@realm2, then
# change any user named mikem into fred
RewriteUsername s/^([^@]+)@realm1/$1@realm2/
RewriteUsername s/^mikem@/fred@/

# Convert a MSN realm/user into user@realm
RewriteUsername s/^(.*)\/(.*)/$2\@$1/

# Translate all uppercase to lowercase
RewriteUsername tr/A-Z/a-z/

# Remove any spaces from a username
RewriteUsername s/\s+//g