SourceLayout: Add enum Direction for AuthUserRequests state logics
The state of credentials lookup and handling is recorded by
authenticateDirection / AuthUserRequest::direction() and its per-scheme
helper methods AuthUserRequest::module_direction().
This formalizes and coordinates the state being returned by using a
shared enum.
The states can generally be considerd as:
- LOOKUP with a helper still needs to validate the credentials
- CHALLENGE if the helepr needs more info from the client
- VALID if everything is fine and the credentials are known Good/Bad
- ERROR if there is any problem with the state or credentials
TODO:
This combination has highlighted a few strange things in the NTLM and
Negotiate states. Where known but Failed credentials are marked as ERROR.
This needs closer investigation why it is not a CHALLENGE in all auth
schemes.
Also there is a little obfuscation of the cases around the generalized
fixHeader() calls. This will be handled in a followup patch.