File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes how to use Spring with LDAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "how to use Spring with LDAP " Watch "how to use Spring with LDAP " New topic
Author

how to use Spring with LDAP

pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
I have problem that how to use spring using LDAP. I want to create user role I write following code but I think I write wrong code
can anyone please tell me correct wat that can be helpful for me.
// configuration file
















William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

All you seem to be getting back are basic attributes of the user.

Do you want a Spring ROLE, or LDAP group memberships? (In Active Directory this is "memberOf")

WP
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
thanks for reply. Actually I want LDAP group membership .My project is I have one form and user will register as user and he will select his role ,after selecting role admin will authenticate thats it.
means i want to separate all admin role and user or student role separate .Thank you.
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

Spring Security does a lot of the heavy lifting for you.

Have a look at This blog post on the subject.


[How To Ask Questions][Read before you PM me]
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
my problem is that how to check login user is admin or user from the db and is their any way to store user information at the time of signup in ldap server and after login how to redirect login user to his page which is
declared in configuration file.

Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

I think for the type of scenarios you are describing that LDAP is probably not your best choice. You will have to explain more what your requirements are and also why you want to use LDAP.
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
hi bill my problem is that i have created separate pages for each user for eg. after login normal user will see his user page, after login admin will see his admin page like that for all users
i have created different pages and I want ti create users group and after login he/she will see his pages that's all
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

any way to store user information at the time of signup in ldap server


Not that it could not be done but it typically is not. Usually LDAP stores things like a phone book, or maybe a business will store all of its employees and assign them roles there. Entries are typically added by an LDAP administrator and applications such as yours just look things up. I guess my question is do you have a requirement to use LDAP? Is there an LDAP server already existing with roles you need to access? It just sounds to me like maybe a DB would be a better fit for you.
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
Thank you. When I am creating group it gives me following error :


my code is :

and this is my Person class:

and this is my conf. file
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

The error you get is because the server can't find the parent node of the entry you are trying to create. Since you have included the base DN in your configuration you must not include it in any other DN's.

change



to

pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
Thanks Bill, I have changed my code whatever you gave in post but still it gives me following error :

Again i post my new edited code :

xml file :





 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use Spring with LDAP
 
Similar Threads
user Authentication problem using LDAPTemplate
user Authentication problem using LDAPTemplate
Spring/AD authentication ServiceUnavailableException ONLY on ssl 636, not 389
Connection problem with Active Directory