<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello</p>
<p>I need an attribute definition that replaces the domain name of
the email address , for example I want to replace:<br>
</p>
<p><i>foo.bar@<b>initialDom</b>.fr</i> to <i>foo.bar@<b>newDom</b>.fr
</i><br>
</p>
<p>my ScriptedAttribute Attribute Definition [1] works fine , but
it cumulates with the previous value , after run I get both values
:</p>
<p><i>mail: <a class="moz-txt-link-abbreviated" href="mailto:foo.bar@initialDom.fr">foo.bar@initialDom.fr</a></i></p>
<p><i> <a class="moz-txt-link-abbreviated" href="mailto:foo.bar@newDom.fr">foo.bar@newDom.fr</a> </i><br>
</p>
<p>I guess I miss use the "add" method , does it exist a way to <b>replace</b>
instead of add in <i> mail.getValues().</i><i><b>add</b></i><i>(nEmail);</i>
? <br>
</p>
<p>[1]</p>
<p><font size="-1"><i><AttributeDefinition
xsi:type="ScriptedAttribute" id="mail" ></i><i><br>
</i><i> <InputDataConnector ref="myLDAP"
attributeNames="mail" /></i><i><br>
</i><i> <AttributeEncoder
xsi:type="SAML1String" name="urn:mace:dir:attribute-def:mail"
/></i><i><br>
</i><i> <AttributeEncoder
xsi:type="SAML2String"
name="urn:oid:0.9.2342.19200300.100.1.3" friendlyName="mail"
/></i></font></p>
<p><font size="-1"><i><Script> <![CDATA[ </i><i><br>
</i></font></p>
<p><font size="-1"><i>
EIDSP=resolutionContext.getAttributeRecipientID();</i><i><br>
</i><i> if( EIDSP==<a class="moz-txt-link-rfc2396E" href="https://sp.domain.fr/sp">"https://sp.domain.fr/sp"</a> )
{</i><i><br>
</i><i> if (mail != null ) {</i><i><br>
</i><i> if
(mail.getValues().get(0).match(".*initialDom*")){</i><i><br>
</i><i> user =
mail.getValues().get(0).split("@")[0];</i><i><br>
</i><i> var newEmail= user +
"@newDom.fr";</i><i><br>
</i><i> <b>
mail.getValues().add(newEmail);</b></i><i><br>
</i><i> }</i><i><br>
</i><i> else {</i><i><br>
</i><i>
(mail.getValues().add(mail)) ;</i><i><br>
</i><i> } }</i><i><br>
</i><i> }]]> </Script>
</AttributeDefinition></i></font><br>
</p>
<p>I tried to blindly use a "replace" , but it method fails : <br>
</p>
<p><font size="-1"><i>mail.getValues().replace is not a function in
<eval> at line number 9</i></font></p>
<p>thanks for your help <br>
</p>
<p><br>
</p>
</body>
</html>