1 Reply Latest reply on Oct 26, 2011 7:01 PM by Sverker Abrahamsson

    Inject Principal

    Sverker Abrahamsson Newbie

      Hi
      I'm working on being able to make portlets with weld and JSF 2 and now I've got to managing the security. I want to be able to retrieve the principal in my bean class. I've therefore added the following attribute:


           @Inject
           private Principal principal;


      I can see when I connect with Eclipse debugger that weld inject a proxy in the principal attribute, but calling any method on it gives a com.sun.jdi.InvocationException.


      To be able to be sure that the issue is not portlet related I've configured it so that I can also access it directly like a normal web application and I get the exact same behaviour there so it's not related to the portlet environment.


      What is needed to do to make injecting principal supported in weld?

        • 1. Re: Inject Principal
          Sverker Abrahamsson Newbie

          Well, I found it. The principal is actually not set, that's why the weld proxy throws that exception. Neither is it possible to get it from session bean context. The reason for that is that Liferay by default does not use JAAS to authenticate but use it's own framework. There is a jaas login module but it's too limited since JBoss implementation essentially only permits username and password to be submitted to authentication.