replace method in AttributeDefinition "ScriptedAttribute" getValues()
Jehan PROCACCIA
jehan.procaccia at tem-tsp.eu
Tue Jan 26 11:08:00 UTC 2021
Hello Pascal
thanks for that example, indeed is looks as what I wanted to do .
I finnaly followed Nate's advice, using Mapped attribute definition instead of a Scripted attribute and for now, it seems to work fine .
I guess that maybe it's even better in terms of performance/overhead to use Mapped attribute vs Scripted ... ?
Anyway, I continue my test/validation toward Mapped attribute now.
Thanks .
----- Mail original -----
De: "Pascal Rigaux" <Pascal.Rigaux at univ-paris1.fr>
À: "users" <users at shibboleth.net>
Envoyé: Mardi 26 Janvier 2021 08:40:26
Objet: Re: replace method in AttributeDefinition "ScriptedAttribute" getValues()
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
--
For Consortium Member technical support, see https://wiki.shibboleth.net/confluence/x/coFAAg
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net
More information about the users
mailing list