added hidden basic auth endpoint

This commit is contained in:
Kenneth Reitz
2011-07-23 20:43:20 -04:00
parent 3eb07bee07
commit 5a9e1f1d42
+10
View File
@@ -152,6 +152,16 @@ def basic_auth(user='user', passwd='passwd'):
return dict(authenticated=True, user=user)
@app.route('/hidden-basic-auth/<user>/<passwd>')
@filters.json
def hidden_basic_auth(user='user', passwd='passwd'):
"""Prompts the user for authorization using HTTP Basic Auth."""
if not check_basic_auth(user, passwd):
return status_code(404)
return dict(authenticated=True, user=user)
if __name__ == '__main__':
app.run()