Since EJB authorization is too limited for my needs I want to use Spring Security together with EJBs. For authentication I want to use Spring Security too. The question is, if I can use the Spring Security context within an EJB.
The scenario:
- user communicates with a servlet
- authentication through Spring Security
- servlet communicates with an EJB
- the EJB may communicate with other EJBs
- security check with an EJB interceptor or directly in the EJB method
Will the security context, usually hold in a thread local object, be propagated through the servlet and ejb layer so that I can use it for security checks?