[jboss-dev-forums] [JBoss AS 7 Development] - Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal
Rick-Rainer Ludwig
do-not-reply at jboss.com
Sun Sep 16 14:56:35 EDT 2012
Rick-Rainer Ludwig [https://community.jboss.org/people/rick-rainer.ludwig] created the discussion
"Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal"
To view the discussion, visit: https://community.jboss.org/message/759783#759783
--------------------------------------------------------------
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?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/759783#759783]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120916/4b37af4c/attachment.html
More information about the jboss-dev-forums
mailing list