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();
}