• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass a securityContext onto an EJB container (JBoss)

 
Andrey Rybak
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, evereone.

How can I get user roles in a session bean ?
isCallerInRole returns "no security context available" null-pointer
exception.

A SessionContext parameter passed in by the container to setSessionContext function does not contain this information.

Assuming I will somehow manage to get the necessary information,
where to store it so that isCallerInRole could use it ?
Does JBoss handle it for me ?

Thanks a lot for your kind help.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a user is authenticated through the web tier, JBoss will propagate this information to the business tier automatically.
 
Andrey Rybak
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the user is authenticated, however no securityContext propagation occurs.

If I'm passing an entire request object as a parameter to an ejb,
then only username passes with it, not the securityContext.

So request.isUserInRole function works fine outside of an ejb but
does not inside it.

Thus I'm compelled either to query all the necessary roles outside of the ejb and pass them as additional parameters, which is silly, or pass a username as a parameter and access the user_roles table from inside, which is tedious.

There are rumors of a plugins that handle this issue in weblogic and websphere. Is there something similar in JBoss ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!