Hello Humberto,

I was able to make LDAP Authentication work.. :-).
Yes you are right that code in CVS Head is having the required
changes.

But let me tell you, I downloaded the code
http://jakarta.apache.org/builds/jakarta-turbine/turbine-2/release/2.2/


I had few changes in TR.prop file, as while reading the TR.prop files
using getString() function, it does not read the values properly, so I
tried replacing 

services.SecurityService.ldap.security.athentication=simple
services.SecurityService.ldap.port=389
services.SecurityService.ldap.host=164.99.140.150
services.SecurityService.ldap.admin.username=cn/admin%o/n
services.SecurityService.ldap.admin.password=n
services.SecurityService.ldap.user.basesearch=ou/users
services.SecurityService.ldap.user.search.filter=
services.SecurityService.ldap.dn.attribute=cn
services.SecurityService.ldap.provider=com.sun.jndi.ldap.LdapCtxFactory

with 

ldap.security.athentication=simple
ldap.port=389
ldap.host=164.99.140.150
ldap.admin.username=cn/admin%o/n
ldap.admin.password=n
ldap.user.basesearch=ou/users
ldap.user.search.filter=
ldap.dn.attribute=cn
ldap.provider=com.sun.jndi.ldap.LdapCtxFactory

then it worked.. :-( 


- Sachin  

 

>>> [EMAIL PROTECTED] 6/24/2003 11:17:18 PM >>>
I am looking into fixing this in LDAP. The code looks OK in the CVS
Head.
But the version in TURBINE_2_2_BRANCH is older.

My understanding is that I should fix the code in the
TURBINE_2_2_BRANCH
eventhough the version in the CVS head doesn't have the same problem.

Is this correct? I am asking because I don't want to screw things up.

--
  Humberto

> -----Original Message-----
> From: Sachin Kumar [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, June 21, 2003 2:15 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] 
> Subject: RE: Bug in LDAP Authentication
> 
> 
> Thank you.
> 
> You can get the turbiine source code at
> http://jakarta.apache.org/builds/jakarta-turbine/turbine-2/rel 
> ease/2.2/
> turbine-2.2-src.tar.gz.
> Once you have the source code then the files are in directory
> turbine-2.2/src/java/org/apache/turbine/services/security/ldap 
> 
> --------------------------------------------------------------
> ----------------------------
> source for LDAPUserManager.java where i made changes is:
> 
>    * Creats an initial context.
>      *
>      * @param ldap admin username supplied in TRP.
>      * @param ldap admin password supplied in TRP
>      * @throws DataBackendException Error accessing the data
backend.
>      * @throws UnknownEntityException if the user account is not
> present.
>      * @throws NamingException when an error occurs with the named
> server.
>      */
>     public DirContext bind(String username, String password)
>         throws NamingException, DataBackendException,
> UnknownEntityException
>     {
>         DirContext ctx = null;
> 
>         try
>         {
>             String host = TurbineResources.getString(LDAP_HOST);
>             String port = TurbineResources.getString(LDAP_PORT);
>                       // Added by
> Sachin---------------------------------
>                       String ldapProvider =
> TurbineResources.getString(LDAP_PROVIDER);
>                       String ldapAuthentication =
> TurbineResources.getString(LDAP_AUTHENTICATION);
>                       // --------------- End
> ----------------------------
> 
> 
>             String providerURL = new String("ldap://"; + host + ":" +
> port);
> 
>             /*
>              * creating an initial context using Sun's client
>              * LDAP Provider.
>              */
>             Hashtable env = new Hashtable();
> 
>             // Code Before---------------------------------------
>             //env.put(Context.INITIAL_CONTEXT_FACTORY,
LDAP_PROVIDER);
>             //env.put(Context.SECURITY_AUTHENTICATION, "simple");
>             // --------------End---------------------------------
> 
>                       // Added by
> Sachin--------------------------------------
>                       env.put(Context.INITIAL_CONTEXT_FACTORY,
> ldapProvider);
>               env.put(Context.SECURITY_AUTHENTICATION,
> ldapAuthentication);
>                       //--------------- End
> ----------------------------------
> 
>             env.put(Context.PROVIDER_URL, providerURL);
> 
>             env.put(Context.SECURITY_PRINCIPAL, username);
>             env.put(Context.SECURITY_CREDENTIALS, password);
> 
>             ctx = new javax.naming.directory.InitialDirContext(env);
>             Log.debug("CTX: " + ctx.toString());
>         }
>         catch (NamingException ne)
>         {
>             String errno =
> ParseExceptionMessage.findErrno(ne.getExplanation());
> 
>             if (errno.equals("49"))
>             {
>                 throw new UnknownEntityException(
>                     "The given credentials for the administrator are
> invalid");
>             }
>             else if (errno.equals("22"))
>             {
>                 throw new DataBackendException(
>                     "The LDAP server specified is unavailable");
>             }
>             else
>             {
>                 throw ne;
>             }
>         }
>         catch (Exception e)
>         {
>             Log.error(e);
>         }
> 
>         return ctx;
>     }
> }
> 
> --------------------------------------------------------------
> ---------------------------------
> LDAPSecurityConstants.java:
> 
> 
> public interface LDAPSecurityConstants
> {
>     public static final String LDAP_DN_ATTR = "ldap.dn.attribute";
>     public static final String LDAP_SEARCH_FLTR =
> "ldap.user.search.filter";
>     public static final String LDAP_BASE_SERACH =
> "ldap.user.basesearch";
>     public static final String LDAP_ADMIN_USRNAME =
> "ldap.admin.username";
>     public static final String LDAP_ADMIN_PASSWRD =
> "ldap.admin.password";
>     public static final String LDAP_HOST = "ldap.host";
>     public static final String LDAP_PORT = "ldap.port";
>     public static final String LDAP_PROVIDER = "ldap.provider";
>     // Added by Sachin
----------------------------------------------
>     public static final String LDAP_AUTHENTICATION =
> "ldap.security.authentication";
>       // ------------------- End
> -------------------------------------
>  }
> 
> --------------------------------------------------------------
> ---------------------------------
> 
> 
> 
> 
> >>> [EMAIL PROTECTED] 6/20/2003 10:42:18 PM >>>
> OK. I will look into it.
> But I didn't get the sources.
> 
> > -----Original Message-----
> > From: Sachin Kumar [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, June 20, 2003 11:45 AM
> > To: [EMAIL PROTECTED] 
> > Subject: Bug in LDAP Authentication
> > 
> > 
> > Hello,
> > 
> > I tried to use LDAP for authentication instead of database doing
all
> > what it needs, but could not authenticate. 
> > In log I found that there is bug in turbine code itself, which was
> > clear from the errors in log , they are as below:
> > error: Cannot instantiate class ldap.provider
> > then it says
> > Exception:   org.apache.turbine.util.security.DataBackendException

> :
> > The LDAP data Server is unavailable
> > 
> > This means that the class it is reading from
> > TurbineResources.properties is ldap.provider instead of the 
> > actual value
> > provided in TurbineResources.properties file.
> > I have fixed the problem, in files LDAPUserManager.java and
> > LDAPSecurityConstants.java  attached below with my comments 
> > where all I
> > made changes.
> > Request you to please replace these files with the old ones and
> build
> > it and let me know from where I could get new tdk with this
problem
> > fixed. 
> > It would be of great help to me.
> > 
> > Meanwhile I am trying to build the Turbibe-2.2 source using Maven,
> but
> > currently facing some problems in it.
> > Pl. look into it ASAP and if possible pl. reply.
> > 
> > thanks in advance
> > Regards,
> > Sachin
> > 
> > 
> >     
> >  
> > 
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED]

> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED]

> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to