[JIRA] Resolved: (SSPCPP-472) AttributeExtractor: remove leading/trailing whitespace created by formatter

Scott Cantor (JIRA) noreply at shibboleth.net
Fri Jul 6 17:50:55 EDT 2012


     [ https://issues.shibboleth.net/jira/browse/SSPCPP-472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor resolved SSPCPP-472.
---------------------------------

    Resolution: Fixed

http://svn.shibboleth.net/view/cpp-sp?rev=3724&view=rev

Reviewed code base. Most of the new extraction features are already trimming data. Identified a pair of common exceptions in the ExtensibleAttribute and NameIDAttribute serialization logic, which is where those formatter strings get applied. I added automatic trimming there.

Also added trimming in the new resolver plugins that are likely to introduce whitespace when combining attributes.

I note that the specific example given is not something the code can look into. It doesn't know that your formatting string has an internal need for trimming inside itself.

It might be possible to pull that off with some kind of combination of extraction and Transform resolver steps.

> AttributeExtractor: remove leading/trailing whitespace created by formatter
> ---------------------------------------------------------------------------
>
>                 Key: SSPCPP-472
>                 URL: https://issues.shibboleth.net/jira/browse/SSPCPP-472
>             Project: Shibboleth SP - C++
>          Issue Type: Improvement
>          Components: Attribute Resolution / Filtering
>    Affects Versions: 2.5
>            Reporter: Peter Schober
>            Assignee: Scott Cantor
>            Priority: Trivial
>             Fix For: 2.5
>
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
>
> Given a Metadata AttributeExtractor like that:
> {code:xml}
> <AttributeExtractor type="Metadata">
>   <ContactPerson id="tech-c" contactType="technical" formatter="&lt;a href='$EmailAddress'&gt;$GivenName $SurName&lt;/a&gt;" />
> </AttributeExtractor>
> {code}
> and ContactPerson entries in metadata containing only a SurName or only a GivenName (which seems to be a common way of specifying the name for a role account, taking into account that Good Practice as well as e.g. eduGAIN recommend use of Role accounts instead of personal accounts in ConcactPerson elements) the resulting formatted Attribute would look something like that:
> {noformat}
> <a href='mailto:tech at example.edu'> Technical Support</a>
> {noformat}
> with a leading (or trailing, in case of missing SurName) blank, introduced by above formatter (so clearly it's the admins choice; here the admin coulld have split "Technical" and "Support" into Given and SurName but that's both unattainable on a global scale and might not always be possible when there's only one word-like component).
> Could the metadata attribute extractor (in the formatting stage) remove any leading and/or trailing blanks (or whitespace)? Of course there could be anything put into the formatter by the admin but removing whitespace shouldn't do any harm here, I would hope.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the commits mailing list