An LDAP attribute mail has the following raw value: [email protected].
How can it be trimmed to a result string value: example123usergmailcom, by removing all the special characters?
One of the federation application requires this.
ALL SiteMinder version and Platform.
Custom built expression is required.
LTRIM or RTRIM function eliminates spaces, but not actual character.
1. Define additional user attribute mapping list under SiteMinder directory properties using active expression:
modifiedemail (Expression): TRANSLATE(mail,'@','') //removing @ sign from mail attribute
modifiedemail2 (Expression): TRANSLATE(modifiedemail,'-','') //removing - sign from modifiedemail
2. Define agent response in a protected domain.
WebAgent-HTTP-Header-Variable mymail=<%userattr="modifiedemail" %>
WebAgent-HTTP-Header-Variable mymail2=<%userattr="modifiedemail2" %>
3. Test result after user authorization.
0> id 224, len 023 : 'businesscategory=active' - '61 63 74 69 76 65 '
1> id 224, len 031 : 'mymail2=example_123usergmail.com' - '61 76 69 6e 61 73 68 5f 31 32 33 6e 65 77 67 6d 61 69 6c 2e 63 6f 6d '
3> id 224, len 031 : 'mymail=example_123-usergmail.com' - '61 76 69 6e 61 73 68 5f 31 32 33 2d 6e 65 77 67 6d 61 69 6c 2e 63 6f 6d '
4> id 224, len 008 : 'cn=example' - '75 73 65 72 31 '
Noticed that mymail2 is still NOT the complete result as wished for yet, but it did remove both @ and - character.
One will have to create more additional user attribute mapping, until ALL the known special chars are removed from string.
Due to recursive modification of the same attribute, this expression implementation needs to pass performance testing in QA first before go live.
Alternatively, develop a custom assertion plugin, to modify the email address attribute in real time as appropriate.