Checking for regex match of attribute values in a script

Wessel, Keith kwessel at illinois.edu
Wed Feb 21 14:50:42 EST 2018


Interesting suggestion, David. I had already coded a solution with a for loop, but your solution is probably much more efficient. I could make another attribute that’s a mapped attribute and that does the regex mapping then use its results in my script. This would, I assume, be more efficient code as I assume the mapped attribute code behind the scenes is more efficient than iterating over all values of the attribute to do regex matches. Is that assumption true, Scott?

Thanks,
Keith


From: users [mailto:users-bounces at shibboleth.net] On Behalf Of IAM David Bantz
Sent: Wednesday, February 21, 2018 12:12 PM
To: Shib Users <users at shibboleth.net>
Subject: Re: Checking for regex match of attribute values in a script

We "ValueMap" memberOf values with regex to extract (possibly multiple) attribute values.*
Not exactly what you asked for but a possible alternative depending on your precise need(s).

David Bantz

*e.g.,


        <ValueMap>

          <ReturnValue>arn:aws:iam::$1:role/$2,arn:aws:iam::$1:saml-provider/OITshibb</ReturnValue>

          <SourceValue ignoreCase="true">cn=aws:([0-9]+):role:(.*?),ou=group,dc=alaska,dc=edu</SourceValue>

        </ValueMap>


On Wed, Feb 21, 2018 at 7:23 AM, Wessel, Keith <kwessel at illinois.edu<mailto:kwessel at illinois.edu>> wrote:
Hi, all,

We've got a scripted attribute definition that checks for several values of memberOf with memberOf.getValues().contains(). I'd like to convert this to use a regex to match partial group names....
Is there a way to do a regex match on attribute values with contains()? Or do I need to iterate through the attribute values with a loop to do this comparison? Or is there another method on collections that I should be using other than contains()?

Thanks,
Keith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20180221/4ed68a5c/attachment.html>


More information about the users mailing list