directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Endi S. Dewata" <end...@safehaus.org>
Subject [ApacheDS] How to use Interceptor.bind() ?
Date Wed, 22 Feb 2006 21:05:45 GMT
Hi,

I'm currently using a custom authenticator to handle bind operations and
it's been working just fine. I noticed that a bind() method has been added
to Interceptor and I'm wondering if I should use this instead. I've tried to
implement the method in a custom interceptor but am not getting good
results. Here's the code:

public void bind(
    NextInterceptor nextInterceptor,
    Name bindDn,
    byte[] credentials,
    List mechanisms,
    String saslAuthId) throws NamingException {

    boolean authenticated = ...

    if (!authenticated) throw new LdapAuthenticationException();

    // call next interceptor?
    nextInterceptor.bind(bindDn, credentials, mechanisms, saslAuthId);
}

Basically if the authentication fails the code would throw an
LdapAuthenticationException. This is working fine, the client will receive
an "Invalid credentials" (49). However, when the authentication succeeds I'm
not sure what to do here.

If the code just returns immediately, the client will receive an "Alias
problem" (33). If the code calls the next interceptor, ApacheDS will call
the lookup() method anonymously to get the userPassword attribute of the
user. Since my program won't return anything to unauthenticated users, this
operation will fail eventually with "Invalid credentials" (49).

What is the proper way to use Interceptor.bind()? Or is this a bug? I put my
interceptor in front of the other interceptors, is this a problem? Thank you
very much.


--
Endi S. Dewata


Mime
View raw message