You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by "Andrejkovics, István" <ia...@jaguar.dote.hu> on 2002/11/04 12:53:52 UTC
Experiences with the LDAP implementation
I tested the LDAP implementation a bit using the 2002-10-27
nightly build and configuring it as David proposed.
Here are my experiences:
- Jetspeed authentication works, that is, Jetspeed is able to
authenticate from an LDAP server.
- Creating a user with jetspeed does not work: it throws a NullPointer
exception. The problem is, as I traced back, that when the LDAPUser
object is created with the LDAPUser() constructor, some fields of the
object (for example tempStorage, permStorage) are not properly
initialized. As a solution, I modified the LDAPUser() constructor
to call the LDAPUser(String UserName, boolean isNew) constructor.
Here is the modification:
--- LDAPUser.java.old Tue Oct 22 00:31:15 2002
+++ LDAPUser.java.new Mon Nov 4 10:32:17 2002
@@ -101,7 +101,7 @@
private Vector grouprole= null;
public LDAPUser(){
- isNew = true;
+ this("NewUser", true);
}
/**
* Constructor.
With this modification I was able to create new users within jetspeed.
- There is no place in the LDAP schema (jetspeed.schema) to store the
first name of a user. So I made the following modification:
--- jetspeed.schema.old Tue Oct 22 00:37:29 2002
+++ jetspeed.schema.new Mon Nov 4 11:37:58 2002
@@ -55,7 +55,7 @@
objectclass ( 1.3.6.1.4.1.7915.1.2.4.4 NAME 'jetspeeduser'
DESC 'Jetspeed User'
MUST ( uid $ userPassword )
- MAY ( mail $ name $ sn $ confirm $ usergrouprole) )
+ MAY ( mail $ name $ sn $ givenName $ confirm $ usergrouprole) )
objectclass ( 1.3.6.1.4.1.7915.1.2.4.5 NAME 'jetspeedpsml'
DESC 'Jetspeed PSML'
I also modified LDAPUser.java to read in and write back the
givenName attribute. I also corrected the update(boolean create)
method to write back the confirm and sn (surname) attributes, and
to avoid the encryption of an already encrypted password.
--- LDAPUser.java.old Tue Oct 22 00:31:15 2002
+++ LDAPUser.java.new Mon Nov 4 10:32:17 2002
@@ -130,6 +130,7 @@
setName(getutil("name"));
setEmail(getutil("mail"));
setLastName(getutil("sn"));
+ setFirstName(getutil("givenName"));
setUserName(UserName);
this.grouprole = getutil("usergrouprole",true);
}
@@ -146,6 +147,7 @@
setUserName(getutil("uid"));
setEmail(getutil("mail"));
setLastName(getutil("sn"));
+ setFirstName(getutil("givenName"));
setName(getutil("name"));
setConfirmed(getutil("confirm"));
try{
@@ -155,8 +157,14 @@
this.grouprole = getutil("usergrouprole",true);
}
public boolean update(boolean create){
-
setutil("userPassword","{crypt}"+UnixCrypt.crypt((String)getPerm(User.PASSWORD)));
+ String pwd = (String)getPerm(User.PASSWORD);
+ if (!pwd.startsWith("{crypt}")) pwd="{crypt}"+UnixCrypt.crypt(pwd);
+ setutil("userPassword",pwd);
setutil("mail",(String)getPerm(User.EMAIL));
+ setutil("confirm",(String)getPerm(User.CONFIRM_VALUE));
+ setutil("sn",(String)getPerm(User.LAST_NAME));
+ setutil("givenName",(String)getPerm(User.FIRST_NAME));
+
if (JetspeedLDAP.exists(ldapurl)){
JetspeedLDAP.deleteAttrs(ldapurl,rmAttrs);
JetspeedLDAP.updateEntry(ldapurl,myAttrs);
With these modifications I was able to modify the details (first name,
last name and email) of an account within jetspeed, but only if I
did not change the password. Unfortunately, the changePassword method
of the LDAPUserManagement class does not seem to work: it throws an
UnknownUserException even if I give the correct password, but I was
unable to find out, why.
I hope I could help,
Istvan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>