0 Replies Latest reply on Apr 8, 2006 10:50 AM by Konstantin Kolev

    Implementing custom authentication service.

    Konstantin Kolev Newbie

      Hi, to evrybody!
      First of all I would like to say that I found jBPM identity component pretty easy to use.
      Of course there are always some problems.
      I've just tried to implement my own custom authentication service. Following the documentation that says:

      In each situation where jBPM needs to know who is running the code, the central method org.jbpm.security.Authentication.getAuthenticatedActorId() is called. That method will delegate to an implementation of org.jbpm.security.authenticator.Authenticator. By specifying an implementation of the authenticator, you can configure how jBPM retrieves the currently authenticated actor from the environment.

      What I saw from the code was that method
      getAuthenticatedActorId()
      belongs to the class
      SecurityHelper

      So I implemented the AuthenticatedService with a class called CustomAuthenticationService.
      The problem is that when it comes to instantiating the class I got Class Cast Exception:
      17:39:57,484 [http-50600-Processor23] ERROR PenSoftLogger:20 - java.lang.ClassCastException: com.pensoftbg.services.identity.CustomAuthenticationService
      java.lang.ClassCastException: com.pensoftbg.services.identity.CustomAuthenticationService
       at org.jbpm.svc.Services.getServiceFactory(Services.java:117)
       at org.jbpm.svc.Services.getService(Services.java:134)
       at org.jbpm.svc.Services.getAuthenticationService(Services.java:163)
       at org.jbpm.JbpmContext.setActorId(JbpmContext.java:451)
       at com.pensoftbg.framework.util.JbpmManager.getJbpmContext(JbpmManager.java:49)
       at com.pensoftbg.services.processDefinition.ProcessDefinitionServiceImpl.deployProcessDefinition(ProcessDefinitionServiceImpl.java:47)
       at com.pensoftbg.pages.workflow.ProcessDefinitionView.onDeployProcessDefinition(ProcessDefinitionView.java:101)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:94)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at com.pensoftbg.services.J2eeLoginFilter.doFilter(J2eeLoginFilter.java:44)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at com.pensoftbg.framework.j2ee.J2eeGeneralFilter.doFilter(J2eeGeneralFilter.java:100)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:444)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:287)
       at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:84)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
       at java.lang.Thread.run(Thread.java:595)

      It is thrown on line
      DefaultAuthenticationService authenticationService = (DefaultAuthenticationService) services.getAuthenticationService();
      
      which is the first line in
      public void setActorId(String actorId)
      method of JbpmContext.
      It seems that my CustomAuthenticationService cannot be cast to DefaultAuthenticationService :(
      I also tried my CustomAuthenticationService to extend DefaultAuthenticationService but the result is the same :(
      What Am I doing wrong?

      Any help is appreciated.

      Saviola