adding cutsom auth from http://flask.pocoo.org/snippets/8/