directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <kayyag...@apache.org>
Subject Re: How to add a custom Authenticator using API
Date Sat, 31 Jul 2010 07:19:00 GMT
hi Roy,

    You have to do that before starting up the directory service
    e.x

            AuthenticationInterceptor authInterceptor = (
AuthenticationInterceptor ) directoryService.getInterceptor(
AuthenticationInterceptor.class.getName() );
        Set<Authenticator> authenticators = authInterceptor.getAuthenticators();
        if( authenticators == null )
        {
            authenticators = new HashSet<Authenticator>();
        }

       // add your authenticator
       authenticators.add(new MyAuthenticator("MyAuthenticator"));

       authInterceptor.setAuthenticators( authenticators );

      // finally start the directoryService
      directoryService.startup();


Kiran Ayyagari


On Sat, Jul 31, 2010 at 6:47 AM, Benjamin, Roy <rbenjamin@ebay.com> wrote:
> Hi,
>
> I'm starting from the example at: http://directory.apache.org/apacheds/1.5/43-embedding-apacheds-as-a-web-application.html
>
> I want to run ApacheDS embedded in Tomcat, finally got that working with this example.
>
> Now, I need to add a custom authenticator.
>
> Being late on Friday I tried:
>
>
> List<Interceptor> interceptors = directoryService.getInterceptors();
> System.out.println(interceptors == null ? "Yikes!" : interceptors.size());
> for (Interceptor interceptor:interceptors) {
>        System.out.println(interceptor.getName());
>        if (interceptor instanceof AuthenticationInterceptor) {
>                Set<Authenticator> authenticators = ((AuthenticationInterceptor)interceptor).getAuthenticators();
>                if (null == authenticators) {
>                        authenticators = new HashSet<Authenticator>(0);
>                        ((AuthenticationInterceptor)interceptor).setAuthenticators(authenticators);
>                }
>                authenticators.add(new MyAuthenticator("MyAuthenticator"));
>                System.out.println("authenticators:" + authenticators);
>        }
> }
>
> I'm sure this is wrong (see below).  Any help greatly appreciate das usual!
>
> Roy
>
> javax.servlet.ServletException: Bind requests only tunnel down into partitions if there
are no authenticators to handle the mechanism.
> Check to see if you have correctly configured authenticators for the server.
>        org.apache.directory.server.core.RootDseServlet.doGet(RootDseServlet.java:86)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>        com.ebay.trading.salestax.vertex.VertexCalFilter.doFilter(VertexCalFilter.java:104)
>
> root cause
>
> org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException: Bind
requests only tunnel down into partitions if there are no authenticators to handle the mechanism.
> Check to see if you have correctly configured authenticators for the server.
>        org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition.bind(JdbmPartition.java:577)
>        org.apache.directory.server.core.partition.DefaultPartitionNexus.bind(DefaultPartitionNexus.java:800)
>        org.apache.directory.server.core.interceptor.InterceptorChain$1.bind(InterceptorChain.java:206)
>      .....
>

Mime
View raw message