Results 1 to 3 of 3

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

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    1

    Default 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. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    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.
    Spring - by Pivotal
    twitter @tekul

  3. #3
    Join Date
    Jan 2007
    Posts
    12

    Default

    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>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •