I am trying to create a custom AuthenticationManager implementation.
I started by a copy/paste of StandardAuthenticationManagerImpl (which basically does nothing!) and created a nice custom-auth.jar file.
I put that jar in workspace/tomcat/lib and modified the auth.AuthenticationManager property in authenticationManager-config.properties.
When I start the portal from the studio I have two options:
-
if I did not add console common-server in tomcat lib I get HTTP 500 when trying to open the portal with org/bonitasoft/console/common/server/auth/AuthenticationManager (classnotfound exception in tomcat log)
-
if I create the jar with its dependencies (or add console common-server to tomcat/lib) the error is org.bonitasoft.console.common.server.auth.AuthenticationManagerNotFoundException: The AuthenticationManager implementation com.mycompany.AuthenticationManagerImpl does not exist!
I checked the jar file and the .class for AuthenticationManagerImpl is in the file and being in tomcat/lib should be in the classpath.
What did I miss?
I finally understood my problem. The problem is the order of class loading. If the custom auth manager implementation is added to tomcat/lib then the jar containing org.bonitasoft.console.common.server.auth.AuthenticationManager is not yet loaded (it is provided by the tomcat app). Adding common-server to tomcat/lib leads to ClassCastExceptions because AuthenticationManager is loaded twice!
To solve this I put my custom jar into webapps/bonita/WEB-INF/lib along with bonita provided jars and it works.
@g.lapierre …can you eloborate on how you solved the issue a little, bcoz even after placing the all3 jars common-console,server and custom jar in web-inf/lib, still getting the same Error.
2019-07-20 14:51:39.696 +0530 SEVERE: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bonita].[loginService] Servlet.service() for servlet [loginService] in context with path [/bonita] threw exception [javax.servlet.ServletException: org.bonitasoft.console.common.server.auth.AuthenticationManagerNotFoundException: The AuthenticationManager implementation help.bpms.bonita.authentication.ldap.LdapAuthenticationManagerImpl does not exist!] with root cause
org.bonitasoft.console.common.server.auth.AuthenticationManagerNotFoundException: The AuthenticationManager implementation help.bpms.bonita.authentication.ldap.LdapAuthenticationManagerImpl does not exist!