replace method in AttributeDefinition "ScriptedAttribute" getValues()
jehan Procaccia tem-tsp
jehan.procaccia at tem-tsp.eu
Mon Jan 25 21:51:44 UTC 2021
Hello
I need an attribute definition that replaces the domain name of the
email address , for example I want to replace:
/foo.bar@*initialDom*.fr/ to /foo.bar@*newDom*.fr /
my ScriptedAttribute Attribute Definition [1] works fine , but it
cumulates with the previous value , after run I get both values :
/mail: foo.bar at initialDom.fr/
/ foo.bar at newDom.fr /
I guess I miss use the "add" method , does it exist a way to *replace*
instead of add in /mail.getValues().//*add*//(nEmail);/ ?
[1]
/<AttributeDefinition xsi:type="ScriptedAttribute" id="mail" >//
// <InputDataConnector ref="myLDAP" attributeNames="mail"
/>//
// <AttributeEncoder xsi:type="SAML1String"
name="urn:mace:dir:attribute-def:mail" />//
// <AttributeEncoder xsi:type="SAML2String"
name="urn:oid:0.9.2342.19200300.100.1.3" friendlyName="mail" />/
/<Script> <![CDATA[ //
/
/EIDSP=resolutionContext.getAttributeRecipientID();//
// if( EIDSP=="https://sp.domain.fr/sp" ) {//
// if (mail != null ) {//
// if
(mail.getValues().get(0).match(".*initialDom*")){//
// user =
mail.getValues().get(0).split("@")[0];//
// var newEmail= user + "@newDom.fr";//
//*mail.getValues().add(newEmail);*//
// }//
// else {//
//(mail.getValues().add(mail)) ;//
// } }//
// }]]> </Script> </AttributeDefinition>/
I tried to blindly use a "replace" , but it method fails :
/mail.getValues().replace is not a function in <eval> at line number 9/
thanks for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20210125/f861ab88/attachment.htm>
More information about the users
mailing list