# but it is not possible to write a compliant regexp without perl style
# regular expressions (or at least not a legible one).
#
+
+ nai_regexp = "^([^@]*)(@([-[:alnum:]]+\\.[-[:alnum:].]+))?$"
+
split_username_nai {
- if(User-Name =~ /^([^@]*)(@([-[:alnum:]]+\\.[-[:alnum:].]+))?$/){
+ if(User-Name =~ /${policy.nai_regexp}/){
update request {
Stripped-User-Name := "%{1}"
Stripped-User-Domain = "%{3}"
}
}
+ #
+ # If called in post-proxy we modify the proxy-reply message
+ #
+
+ split_username_nai.post-proxy {
+ if(proxy-reply:User-Name =~ /${policy.nai_regexp}/){
+ update proxy-reply {
+ Stripped-User-Name := "%{1}"
+ Stripped-User-Domain = "%{3}"
+ }
+ updated
+ }
+ else{
+ noop
+ }
+ }
+
#
# Forbid all attempts to login via realms.
#