[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
JNDI + Openldap
- To: openldap-technical@openldap.org
- Subject: JNDI + Openldap
- From: Vitor Braga <vitor.leitebraga@gmail.com>
- Date: Thu, 14 Oct 2010 08:34:09 -0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=pHItIpnXcuXa9hfNHq5i8L3gnFNTUckMyS+liDyib2Y=; b=XrqX0PAKR2Ao9Cq1rvBuE4WbpSPvvVVMFyvSDDppD8oPjqSvZchkFk+Fc5l2qg5MtS lHoNq+6RbG7t2IrK4YG2wwkZTBS6aDGOrKv0Q9M/1GMPbfXn2rSiSUsjvLfAn9PaqlW2 TljAMDkbyljcB/Jt0ToOWDn8zomj/M8oLpaxM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=XC2bQd6UmO3CYbqiEP+IWlkmxtXkLYjClQOQW5sNjAQo9Bup2H6wzxDjmOeLL+pO6J h+QdG3BfjMnF3XiZ5kyoXxqf5nCuIaPDR0Y7MZnjjBVHoamJozL2ZNlST4qUkhgArTIS IEY00olizYXQl2EAk0WRZHz5G5Yd+qoW/I54A=
Hello!
First sorry if i'm posting in the wrong place, my question is really about JNDI, but I decided to post here also if anyone knows.
I'm having trouble using bind() to insert a user in ldap. Every time I enter, it goes with the type "default", think like a Java object, when actually i want to enter it as normal ldap user, with a few more fields, etc..
I realized that those users who are already in ldap, listing them is "uid = user1", "uid = user2," and when I insert it becomes "cn = test1", "cn = test2", with fewer fields that other type.
What I would do was to insert a user with those fields that user to "uid = user1" has. I'll post how I'm doing:
If something is wrong, feel free to say! Thanks!
Attribute cn = new BasicAttribute( "cn", "test" );
Attribute gidNumber = new BasicAttribute( "gidNumber", "999" );
Attribute homeDirectory = new BasicAttribute( "homeDirectory", "/home/users/test" );
Attribute javaContainer = new BasicAttribute( "javaContainer" );
javaContainer.add( new BasicAttribute( "cn", "test" ) );
Attribute objectClass = new BasicAttribute( "objectClass" );
objectClass.add( "top" );
objectClass.add( "person" );
objectClass.add( "organizationalPerson" );
objectClass.add( "inetOrgPerson" );
objectClass.add( "posixAccount" );
objectClass.add( "shadowAccount" );
objectClass.add( "sambaSamAccount" );
objectClass.add( "user" );
Attribute sambaSID = new BasicAttribute( "sambaSID", "S-1-5-21-450180999-1854538958-2124921490-61212" );
Attribute sn = new BasicAttribute( "sn", "test" );
Attribute uidNumber = new BasicAttribute( "uidNumber", "4566" );
Attribute userName = new BasicAttribute( "uid", "test" );
Attribute userPassword = new BasicAttribute( "userPassword", "test123" );
Attributes entry = new BasicAttributes();
entry.put( cn );
entry.put( gidNumber );
entry.put( homeDirectory );
entry.put( javaContainer );
entry.put( objectClass );
entry.put( sambaSID );
entry.put( sn );
entry.put( uidNumber );
entry.put( userName );
entry.put( userPassword );
try{
ctx.bind( "cn=test,ou=Users", entry );
} catch( Exception e ){
e.printStackTrace();
}