<div dir="ltr">On Mon, Jun 10, 2013 at 3:17 PM, Douglas E. Engert <span dir="ltr"><<a href="mailto:deengert@anl.gov" target="_blank">deengert@anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><br>
<br>
On 6/5/2013 5:14 PM, Cantor, Scott wrote:<br>
> On 6/5/13 4:02 PM, "Douglas E. Engert" <<a href="mailto:deengert@anl.gov" target="_blank">deengert@anl.gov</a>> wrote:<br>
>><br>
>> I would like to have two LDAP DataConnectors that both need to return a<br>
>> CN attribute.<br>
>> How can I have one return CN as the attribute and the other return some<br>
>> other name so the two attributes don't get mixed up?<br>
>><br>
>> I may be missing something simple, but is there a way to add a prefix<br>
>> to the name of the attributes listed in one of the <ReturnAttributes><br>
><br>
> Not that I'm aware (if there is Daniel will know, or you'll find something<br>
> in the vt-ldap docs about it). There definitely is nothing in the IdP<br>
> itself.<br>
<br>
</div>Did not find any info in their docs, and no one from vt-ldap has responded.<br>
<div><br></div></blockquote><div><br></div><div>You can write a search result handler to copy the ldap attribute:</div><div><br></div><div>{code}</div><div><div>public class CopyCnSearchResultHandler extends CopySearchResultHandler</div>
<div>{</div><div> protected Attributes processAttributes(<br></div><div> final SearchCriteria sc,</div><div> final SearchResult sr)</div><div> throws NamingException</div><div> {</div><div> final Attributes newAttrs = sr.getAttributes();</div>
<div> if (newAttrs.get("cn") != null) {</div><div> final Attribute attr = newAttrs.get("cn");</div><div> final Attribute newAttr = new BasicAttribute("copy-cn", attr.isOrdered());</div>
<div> final NamingEnumeration<?> en = attr.getAll();</div><div> while (en.hasMore()) { newAttr.add(en.next()); }</div><div> newAttrs.put(newAttr);</div><div> }</div><div> return newAttrs;</div>
<div>
}</div><div>}</div></div><div>{code}</div><div><br></div><div>Then add your handler as a property in your resolver configuration:</div><div><br></div><div><LDAPProperty</div><div> name="edu.vt.middleware.ldap.searchResultHandlers" </div>
<div> value="edu.vt.middleware.ldap.handler.FqdnSearchResultHandler,edu.vt.middleware.ldap.handler.EntryDnSearchResultHandler,edu.vt.middleware.ldap.handler.BinarySearchResultHandler,CopyCnSearchResultHandler"/></div>
<div><br></div><div>Note that setting this property overrides the existing result handler configuration, which is why I added them back in addition to the copy cn handler.</div><div>If you are using the mergeResults or lowercasing options, those handlers must be added as well.</div>
<div><br></div><div style>--Daniel Fisher<br></div><div><br></div></div></div></div>