First the code, then the tweaks, and last the headaches.
First I will do a sort of overview, then I’ll go into the code and talk about what I changed, what I took out, and why I changed those sections. I’ll make detours and jump ahead if it seems right to me to do so, but if it seems confusing, just skip it and come back later. All of this information could just be very confusing or it may be way too simple, I don’t know, but here it is.
Change the extension from .doc to .zip and unzip the project. This is the baseline code that I will be building up from and will not work in its current state. Just open it up, take a look, perhaps compare it to the unmodified CustomAuth, and try to get comfortable with what is going on. If your eyes glaze over, that is fine, with time and repeated viewings, it will become clearer.