some exception handling improvements and handling the case where the incoming data is too small and would cause a NegativeArraySizeException
anyway, i still think it is not the most beautiful code I've ever written
some javadoc
removed redundant toString()
UserDetailsImpl now implements CredentialsContainer so the credentials can be erased by spring and will not end in whatever securityContextRepository is chosen
removed unused imports