Some improvements to spring security handling