directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin, Roy" <rbenja...@ebay.com>
Subject How to add a custom Authenticator using API
Date Sat, 31 Jul 2010 01:17:53 GMT
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