3 Replies Latest reply on Jul 15, 2010 3:07 AM by mateusz.mrozewski

    Setting Identity manually

    mateusz.mrozewski

      Hello,
      Is it possible to set the Identity manually? I want to set the Identity to credentials that are obtained from a different source and I don't want to use Seam's authenticate form and action.

        • 1. Re: Setting Identity manually
          herberson

          If I understand your want authenticate the user against a LDAP or something like that.


          I recommend you begin by look in Seam documentation on chapter 15. Security.

          • 2. Re: Setting Identity manually
            serkan.s.eskici.online.nl

            Yes, you can set an existing Principal (obtained from somewhere else) into an Identity objecting by calling:


            identity.acceptExternallyAuthenticatedPrincipal(yourPrincipal);
            

            • 3. Re: Setting Identity manually
              mateusz.mrozewski

              Thank you for the responses.


              @Herberson:
              The real problem is that Seam's identity is not container authentication. My Seam application calls remote EJBs that use @RolesAllowed and get the principal from session context. So what I really need to do is to set the container's principal to Seam's identity. This is doable on JBoss using some JBoss specific classes but is not portable across application servers.
              So I'm trying to do it opposite way - authenticate in container using form based authentication and then based on that set seam's identity. Chapter 15.4 would be the answer how to do it in proper seam way. However at the moment I use Seam 2.0.2.SP1 which does not support identity manager yet (according to documentation).


              @Serkan:
              Thanks, I will try that also. At the moment I use the approach described here: http://sdudzin.blogspot.com/2007/12/windows-sso-with-jboss-seam.html. In my autoLogin() method I get the principal from the request and set the username on Identity and some fake password (the user is authenticated already). Beside that I just get the roles of the user from database and set them on identity. So far it looks like it works.