Shiro, Hibernate and Envers
I've got shiro implemented and it's working quite well. We're now trying to implement envers to do audit logging of our entities in hibernate and that works as well. One problem is we're trying to get the subject making the change from shiro both in normal mode and in runAs mode.
Shiro gets the subject from the current thread and it seems that by the time envers' AuditEventListener is called it's already in a separate thread. Wh开发者_如何学编程ere would be a good hook in hibernate to bind shiro's subject to the current thread. Shiro already has methods to do this but I'd need to override hibernates event caller to bind the subject to the new thread somehow or add additional data to the event that would let me grab it later.Turns out the problem was related to configuration. It was dying in bootstrap which at the time security was not in play since it's a filter in web.xml that turns on the security manager.
精彩评论