Regex in the SHibboleth2.xml

Christopher Bongaarts cab at umn.edu
Fri Apr 29 19:12:21 UTC 2022


On 4/29/2022 2:05 PM, Rick Hoodenpyle wrote:
>
> I often have to separate username from the email address using the 
> following:
>
> <!--<AttributeResolver type="Transform" source="upn">
>
>               <Regex match="^(.+)@(.+)$" dest="LoginID">$1</Regex>
>
>               <Regex match="^(.+)@(.+)$" dest="domain">$2</Regex>
>
> </AttributeResolver>-->
>
> I have a client though that passes an ID through the UID attribute. It 
> begins with a letter K and ends with the numerical ID, example K98456.
>
> The value that this must equate to in my application is a numerical 
> only value, so I am needing to find out how to remove the K and only 
> pass the numbers. I have thought about maybe using the following, but 
> have not had a chance to test it and was wondering if someone out 
> there might already know how to do this.
>
> <!--<AttributeResolver type="Transform" source="uid">
>
>               <Regex match="^(.+)[0-9](.+)$" dest="kuid">$1</Regex>
>
> </AttributeResolver>-->
>
Given K followed by numbers, and extracting just the numbers, you would 
use something like:

<Regex match="^K([0-9]+)$" dest="kuid">$1</Regex>

-- 
%%  Christopher A. Bongaarts   %%cab at umn.edu           %%
%%  OIT - Identity Management  %%http://umn.edu/~cab   %%
%%  University of Minnesota    %%  +1 (612) 625-1809    %%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20220429/bd8b926a/attachment.htm>


More information about the users mailing list