Digest auth refactor