6 Replies Latest reply on Mar 1, 2006 7:10 PM by kukeltje

    import authentication

    boerse

      Hi, i'm trying to authenticate a user:

      The default authenticator is org.jbpm.security.authenticator.JbpmDefaultAutenticator. That implementation will maintain a ThreadLocal stack of authenticated actorId's. Authenticated blocks can be marked with the methods JbpmDefaultAutenticator.pushAuthenticatedActorId(String) and JbpmDefaultAutenticator.popAuthenticatedActorId(). Be sure to always put these demarcations in a try-finally block. For the push and pop methods of this authenticator implementation, there are convenience methods supplied on the base Authentication class. The reason that the JbpmDefaultAutenticator maintains a stack of actorIds instead of just one actorId is simple: it allows the jBPM code to distinct between code that is executed on behalf of the user and code that is executed on behalf of the jbpm engine


      And i:

      import org.jbpm.security.authentication.JbpmDefaultAutenticator;

      and
      public String login() throws NoSuchElementException {
       setAuthorizedUserName(null);
       JbpmDefaultAutenticator.popAuthenticatedActorId();
      
      IdentitySession identitySession = Context.getPersistenceContext().getIdentitySession();
      
      try {
       Object userid = identitySession.verify(userName, userPassword);
       setAuthorizedUserName (userName);
       JbpmDefaultAutenticator.pushAuthenticatedActorId(authorizedUserName);
       return "home";
      } catch (NoSuchElementException e){return "login_error";}
      }
      


      but it says that:
      import org.jbpm.security.authentication.JbpmDefaultAutenticator;

      does not exist (like all the followings objets), what am i doing wrong? i want to authorize a user to enter the system.

      Thank you!

        • 1. Re: import authentication
          vas74

          Hi

          I am using the Authentication instaed of JbpmDefaultAuthentication and it is working fine.


          do you have any particular reason for using bpmDefaultAuthentication ?

          • 2. Re: import authentication
            boerse

            it is not in version 3.1 afaik (at least i don't find it either in the javadoc or in the src->java).

            Which version are you using?
            Thanks!

            • 3. Re: import authentication
              kukeltje

              You know, the code is your friend, as are the docs.

              First of all I assume you are using jBPM 3.0x

              In the extract from the docs you posted I read:

              org.jbpm.security.authenticator.JbpmDefaultAutenticator

              In your code you say

              org.jbpm.security.authentication.JbpmDefaultAutenticator

              I see the difference.... do you... what editor do you use? Most modern editors have code completion etc...

              Ronald

              • 4. Re: import authentication
                boerse

                Hi Ronald

                I'm using version 3.1. In the javadoc, i read:

                Package org.jbpm.security.authentication

                http://docs.jboss.com/jbpm/v3/javadoc/org/jbpm/security/authentication/package-summary.html
                and there there is no JbpmDefaultAuthenticator:

                Class Summary
                DefaultAuthenticationService
                DefaultAuthenticationServiceFactory
                JBossAuthenticationService retrieves the actorId as the name of the principal from the SecurityAssociation.
                JBossAuthenticationServiceFactory
                SubjectAuthenticationService gets the authenticated actor id from the current Subject


                • 5. Re: import authentication
                  boerse

                  ah, and I forgot to say I use Eclipse.

                  • 6. Re: import authentication
                    kukeltje

                    Then you will see two factories and two services in the code completion. One of the factories is configured in the jbpm.cfg.xml (surprisingly the 'default' ;-)) Both extend the org.jbpm.security.AuthenticationService so implement one of your own.

                    The 3.1 doc contains a small error in http://docs.jboss.com/jbpm/v3/userguide/security.html#authentication , but a little digging would have shown this. It only took me 5 minutes to find this without have used this part before. Remember... it is open source, you can see what is going on....