<div dir="ltr">On Mon, Jun 10, 2013 at 3:17 PM, Douglas E. Engert <span dir="ltr">&lt;<a href="mailto:deengert@anl.gov" target="_blank">deengert@anl.gov</a>&gt;</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>
&gt; On 6/5/13 4:02 PM, &quot;Douglas E. Engert&quot; &lt;<a href="mailto:deengert@anl.gov" target="_blank">deengert@anl.gov</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I would like to have two LDAP DataConnectors that both need to return a<br>
&gt;&gt; CN attribute.<br>
&gt;&gt; How can I have one return CN as the attribute and the other return some<br>
&gt;&gt; other name so the two attributes don&#39;t get mixed up?<br>
&gt;&gt;<br>
&gt;&gt; I may be missing something simple, but is there a way to add a prefix<br>
&gt;&gt; to the name of the attributes listed in one of the &lt;ReturnAttributes&gt;<br>
&gt;<br>
&gt; Not that I&#39;m aware (if there is Daniel will know, or you&#39;ll find something<br>
&gt; in the vt-ldap docs about it). There definitely is nothing in the IdP<br>
&gt; 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(&quot;cn&quot;) != null) {</div><div>      final Attribute attr = newAttrs.get(&quot;cn&quot;);</div><div>      final Attribute newAttr = new BasicAttribute(&quot;copy-cn&quot;, attr.isOrdered());</div>


<div>      final NamingEnumeration&lt;?&gt; 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>&lt;LDAPProperty</div><div>  name=&quot;edu.vt.middleware.ldap.searchResultHandlers&quot;   </div>


<div>  value=&quot;edu.vt.middleware.ldap.handler.FqdnSearchResultHandler,edu.vt.middleware.ldap.handler.EntryDnSearchResultHandler,edu.vt.middleware.ldap.handler.BinarySearchResultHandler,CopyCnSearchResultHandler&quot;/&gt;</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>