substring attribute up to first space character

Morris, Andi amorris at cardiffmet.ac.uk
Fri Jun 13 06:55:58 EDT 2014


Thanks everybody, the regex tips were really helpful.

I've created a simple expression, and tested it using online testers, and sent it through to testshib, however I can't see it showing at the other side, but I can see it being sent through our process.log.  I would presume that it is being sent, but perhaps it's coming through empty, and therefore not displaying. I also have a local SP which I tested with, and the same thing happened there.

I've tried two different regex expressions, as below. The first just pulls the first part of the string, the second reads both, and then hopefully just returns the first group. However I see the same thing with both:
________________________________________________________________
<resolver:AttributeDefinition xsi:type="Mapped" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                              id="PersonalRef"
                              sourceAttributeID="description">
 
     <resolver:Dependency ref="myLDAP" />
 
     <DefaultValue passThru="true" />
 
     <!-- Remove any characters after the first space -->
     <ValueMap>
         <ReturnValue>$1</ReturnValue>
         <SourceValue>(^\S*)</SourceValue>
     </ValueMap>
 
</resolver:AttributeDefinition>
_________________________________________________________________
	<resolver:AttributeDefinition xsi:type="Mapped" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                              id="PersonalRef"
                              sourceAttributeID="description">
 
     <resolver:Dependency ref="myLDAP" />
 
     <DefaultValue passThru="true" />
 
     <!-- Remove any characters after the first space -->
     <ValueMap>
         <ReturnValue>$1</ReturnValue>
         <SourceValue>(.*) (.*)</SourceValue>
     </ValueMap>
 
	</resolver:AttributeDefinition>
__________________________________________________________________

Attribute filter is:
<afp:AttributeRule attributeID="PersonalRef">
            <afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>

Any pointers where I might have gone wrong please?

Thanks in advance,
Andi

-----Original Message-----
From: users-bounces at shibboleth.net [mailto:users-bounces at shibboleth.net] On Behalf Of Christopher Bongaarts
Sent: 12 June 2014 17:26
To: users at shibboleth.net
Subject: Re: substring attribute up to first space character

The RegexSplit attribute type might also be useful for this purpose.

On 6/12/2014 9:27 AM, Morris, Andi wrote:
> Thanks Peter,
> That gives me something to work on :)
>
> Cheers,
> Andi
>
> -----Original Message-----
> From: users-bounces at shibboleth.net 
> [mailto:users-bounces at shibboleth.net] On Behalf Of Peter Schober
> Sent: 12 June 2014 15:20
> To: users at shibboleth.net
> Subject: Re: substring attribute up to first space character
>
> * Morris, Andi <amorris at cardiffmet.ac.uk> [2014-06-12 15:11]:
>> Would somebody please be able to help me to create an attribute 
>> definition for an Active Directory's description field but only up to 
>> the first space character? We already have LDAP setup, and can 
>> successfully pull other fields from there, but it's the substring I'm 
>> really struggling to work out.
> Maybe the examples near the end of this page will help?
> https://wiki.shibboleth.net/confluence/display/SHIB2/ResolverMappedAtt
> ributeDefinition
> Something like this:
>
>    <DefaultValue passThru="true" />
>    <ValueMap>
>      <ReturnValue>$1</ReturnValue>
>      <SourceValue>^(.+) .*$</SourceValue>
>    </ValueMap>
>
> -peter
> --
> To unsubscribe from this list send an email to 
> users-unsubscribe at shibboleth.net
> --
> To unsubscribe from this list send an email to 
> users-unsubscribe at shibboleth.net


-- 
%%  Christopher A. Bongaarts   %%  cab at umn.edu          %%
%%  OIT - Identity Management  %%  http://umn.edu/~cab  %%
%%  University of Minnesota    %%  +1 (612) 625-1809    %%

--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net


More information about the users mailing list