tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Burghardt <carsten.burgha...@login-solutions.de>
Subject [PATCH] change jndi auth in tomcat
Date Tue, 03 Dec 2002 14:15:15 GMT
Hi,

I tried to get a ldap-authentification with domino but noticed that the 
current code (I checked tomcat 4.0.6 so if this is obsolete in a newer 
version forgive me) checks the given password with the retrieved one. This 
doesn't work as domino uses a different hash algorithm.
So I changed the getUserDN method from the JNDIRealm to auth with a bind.

Here's my code:

---------
    protected String getUserDN(DirContext context,
                               String username, String credentials)
        throws NamingException {

        if (debug >= 2)
            log("getUserDN(" + username + ")");
        if (username == null)
            return (null);
        if ((userFormat == null) || (userPassword == null))
            return (null);

        // Retrieve the user password attribute for this user
        String dn = userFormat.format(new String[] { username });
        if (debug >= 3)
            log("  dn=" + dn);

        context.addToEnvironment(Context.SECURITY_PRINCIPAL, dn);
        context.addToEnvironment(Context.SECURITY_CREDENTIALS, credentials);
        if (debug >= 3)
            log("Doing a lookup");
        Object user = context.lookup(dn);
        if (user == null)
        {
          log("Lookup failed");
          return (null);
        }

        return (dn);

    }
---------

-- 
Dipl. Inf. Carsten Burghardt
Login & Solutions AG
email: carsten.burghardt@login-solutions.de
Tel: 0821/2488-311     Fax: 0821/2488-180


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message