My application needs a way to call hasPermission(nodeRef, perm) for a different user (i.e., not the user who is currently authenticated). I need to do lots of such calls.
As authentication is bound to the current thread, the only way I see to achieve this is to create a new thread, in it log in as the different user and then use hasPermission() from within that thread – with some sort of producer-consumer code to get the information to the main thread.