Specify priorities for http/https switcher hooks.
Improve comments on http/https switcher hooks.
Rename hooks to conform "<subject>_<object>_<verb>" scheme.
Simplify code.
Move auth-specific http/https redirection rules to a separate file.
Simplify `redirectToProtocol` function.