Add CORS support to auth middleware

This contains a reformat as well as a code change.
The code change was 5 lines around after 75 which was to check for OPTIONS method and not do auth checking for this. 
The reformat was to get rid of mixed indentation (spaces and tabs) that looked bad on IntelliJ.