I have a a custom authentication provider implemented in my spring MVC project. In my own over-riding authenticate() method I implement my own authentication where I construct my own UserPasswordAuthenticationToken() and return the object.
Now the userid in the above said object "UserPasswordAuthentictionToken" is anonymized, password null and the permissions are set to those that are granted to this user.
Question:
Does this cause the SecurityContextHolder or the SecurityContext in general to lose the original incoming credentials inside the Authenticate object that is passed to the overridden authenticate() method?
If it does not, what should I do to drop those original credentials and force Spring security context to hold my new anonymous authentication identifier [preferably along with other meta data ofcourse].