1 Reply Latest reply on Oct 31, 2013 2:18 PM by Shane Bryzak

    Why is login not an idempotent operation?

    Karel Piwko Master



      could you please explain me why login is not idempotent and if already logged in, I get


      org.picketlink.authentication.UserAlreadyLoggedInException: active agent: org.picketlink.idm.model.basic.User@de9fe3a0


      More details at https://issues.jboss.org/browse/AGPUSH-386





        • 1. Re: Why is login not an idempotent operation?
          Shane Bryzak Master

          You taught me a new word today Karel!


          Anyway, the reason for this is the same as described in the comments of the issue you linked.  PicketLink provides session-level tracking of the authenticated user, which is a pretty standard feature of the web.  If you don't wish this behaviour, you can provide an alternative login method in a separate bean which performs a logout first - something like this should work:


          public class MyLoginBean {
              @Inject Identity identity;
              public AuthenticationResult login() {
                 return identity.login();


          You then call MyLoginBean.login() to authenticate instead of Identity.login().