-
1. Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal
jingjingjiang1986 Sep 5, 2012 4:25 AM (in response to sraue)I encouter a problem like this, sessionContext.getCallerPrincipal() always returns a SimplePrincipal instance, and its name is "anonymous", I expected that it would return a customed principal which implements the interface Principal.
At client side, I implement a LoginModule, in the method commit(), add a my own customed principal, then call the remote EJB.
-
2. Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal
rick-rainer.ludwig Sep 16, 2012 2:56 PM (in response to sraue)I have exactly the same issue with JBoss 7.1.1. For the ClassCastException itself, I do not have a solution, but I have a workaround which works until I have a clean and staight solution.
When retrieving the principal via
@Resource
public SessionContext sessionContext;
...
Principal principal = sessionContext.getCallerPrincipal();
I check the name of the instantiated class via
principal.getClass().getName(). equals(MyExpectedPrincipalClass.class.getName())
to assure the correct implementation and to avoid later exceptions. Then I work with reflection to access fields and method via getMethod() and getField(). It works fine, but it is quite ugly. Does anyone have a better idea?
-
3. Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal
rodakr Sep 16, 2012 4:55 PM (in response to rick-rainer.ludwig)Solution for me was, login modul is deployed as jboss modul. No packages from my login module are included in any deployments!.
my login modul is defined in standalone.xml as global, so any class loaders can find it.
I still had to add my login modul as dependency to some othe jboss provided modules... you see while testing which modul get problems, so you add your login modul to this modul as dependecy...