Observer

You shouldn't be doing this in here. Just pass the Provider<HttpServletRequest> where you pass this getCurrentUser. and there do this logic. IF there is duplication find another way. But this logic shoudln't be here