More auth stuff

Added all the bits and pieces the book seems to think will give me
proper auth. I don't think this is done, though.