Hi all,

 

I am trying to use LDAP authentication with CAS. I am able to
authenticate successfully.

 

However, I am having trouble to pick the user's attributes from LDAP.

 

I have configured the attributeRepository bean with the class
org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao as
follows:

 

<bean id="attributeRepository"
class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao"
>

<property name="baseDN" value="XXXXXX" />

      <property name="query" value="(uid={0})" />

      <property name="contextSource" ref="contextSource" />

      <property name="ldapAttributesToPortalAttributes">

            <map>

                  <entry key="cn" value="Name"/>

                  <entry value="Telephone" key="telephoneNumber" />

                  <entry value="Full Name" key="fullName" />

                  <entry value="Email" key="mail" />

            </map>

      </property>

</bean>

 

I wrote the following code in a JSP, and there were no attributes in the
output.

What is wrong here?

 

AttributePrincipal principal =
((org.jasig.cas.client.validation.AssertionImpl)
session.getAttribute("_const_cas_assertion_")).getPrincipal();

out.println("The name of the authenticated user is: " +
principal.getName());

out.println("<br>Is the principal object not having any attributes? - "
+ principal.getAttributes().isEmpty());

out.println("<br>");

 

Map attributes = principal.getAttributes();

Iterator attributeNames = attributes.keySet().iterator();

out.println("<table>");

for (; attributeNames.hasNext();) {

out.println("<tr><th>");

String attributeName = (String) attributeNames.next();

      out.println(attributeName);

      out.println("</th><td>");

      Object attributeValue = attributes.get(attributeName);

      out.println(attributeValue);

      out.println("</td></tr>");

}

out.println("</table>");

 

Let me know what I am missing out. For your information, I have replace
person-directory-1.0.1.jar with 1.1.1.

 

Regards,

Shyam

 

********** DISCLAIMER *******

The information contained in this email is confidential and may contain 
proprietary information. It is meant solely for the intended recipient. Access 
to this email by anyone else is unauthorised. If you are not the intended 
recipient, any disclosure, copying, distribution or any action taken or omitted 
in reliance on this, is prohibited and may be unlawful. No liability or 
responsibility is accepted if information or data is, for whatever reason, 
corrupted or does not reach its intended recipient. Dun & Bradstreet PSAPL 
reserves the right to take any action in accordance with its email policy. If 
you have received this communication in error, please delete this mail & notify 
us immediately at [EMAIL PROTECTED]


_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to