Here's an implementation of the accepted answer with flask-login:
@app.before_request
def require_authorization():
from flask import request
from flask.ext.login import current_user
if not (current_user.is_authenticated or request.endpoint == 'login'):
return login_manager.unauthorized()