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 Tue, 03 Aug 2010 08:10:11 GMT
On Mon, Aug 2, 2010 at 10:02 PM, Benjamin, Roy <rbenjamin@ebay.com> wrote:
> Thanks Kiran,
>
> How can I start an embedded server that uses an apacheds.conf file ?
nope there is currently no way to configure an embedded server through
conf file.

Kiran Ayyagari

>
> Thanks
> Roy
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] On Behalf Of Kiran Ayyagari
> Sent: Saturday, July 31, 2010 12:19 AM
> To: Apache Directory Developers List
> Subject: Re: How to add a custom Authenticator using API
>
> 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