Thank you.

You can get the turbiine source code at
http://jakarta.apache.org/builds/jakarta-turbine/turbine-2/release/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]

Reply via email to