replace method in AttributeDefinition "ScriptedAttribute" getValues()
Pascal Rigaux
Pascal.Rigaux at univ-paris1.fr
Tue Jan 26 07:40:26 UTC 2021
Hi,
Looking at
https://wiki.shibboleth.net/confluence/display/IDP4/ScriptedAttributeDefinition
or
https://wiki.shibboleth.net/confluence/display/IDP30/ScriptedAttributeDefinition
,
you can see an example doing exactly what you want:
eduPersonPrincipalName.getValues().retainAll([]);
There is also another solution with a temp attribute.
cu
jehan Procaccia tem-tsp <jehan.procaccia at tem-tsp.eu> a écrit :
> 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
--
Pascal Rigaux
More information about the users
mailing list