Announcement Announcement Module
Collapse
No announcement yet.
Output an LDAP user's common name (cn) on my JSP... HELP Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Output an LDAP user's common name (cn) on my JSP... HELP

    Dear all,

    I need help on the following:

    I am using LDAP with Spring Security/Acegi

    In my JSP, i need to output 2 things: (a) Username and (b) Common Name of the authenticated user

    For (a) i've used <auth:authentication operation="username"/> to output the username correctly.

    For (b) I've tried to use <auth:authentication operation="attributes"/> to access the attributes of the user and then get his/her Common Name (cn) but i don't know how to do that

    Example: <auth:authentication operation="attributes"/> produces {givenname=givenname: John, sn=sn: Bravo, userpassword=userpassword: [B@13d5f21, mail=mail: johnny.bravo@bravo.com, objectclass=objectClass: organizationalPerson, person, inetOrgPerson, top, uid=uid: bravoj, cn=cn: Johnny Bravo, description=description: Actor}

    My problem: How to output the Common Name (cn) only?!???!

    Please help

  • #2
    Why do it in the JSP? It's much easier to manipulate the data in your controller and add the exact data you want to the view model.

    Comment


    • #3
      Hi,

      I just wanted to use the authz taglib to do it as simple as possible.

      Anyway i found a solution to my problem. I simply used more taglibs . I've used String from apache

      Here's the code:

      HTML Code:
      <string:getPrechomp delimiter=","><string:getChomp delimiter="cn=cn:"><auth:authentication operation="attributes"/></string:getChomp></string:getPrechomp>

      Comment

      Working...
      X