Yes, it will work fine. Depending on the application server you may/or may not have to use JAAS. Most allow you to execute as the last user you retrieved an InitialContext as. Example:
The above code will execute the EJB as the user you passed to the InitialContext. If you still want to go down the JAAS path that is not a problem either but
you should read your Application Server documentation for the appropriate way to authenticate via JAAS. Also remember you will have to execute your EJB call as part of a PrivelegedAction to propagate the user principal... this also might require a call to a vendor-specific API. For example, in WLS 6.1 you could do a plain Subject.doAs() but in WLS 8.1 you need to use weblogic.security.Security.runAs() instead.