From 5a9e1f1d42cd331f711ff92c6f2c6d6015a85056 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 23 Jul 2011 20:43:20 -0400 Subject: [PATCH] added hidden basic auth endpoint --- httpbin/core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/httpbin/core.py b/httpbin/core.py index a558387..beb019d 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -152,6 +152,16 @@ def basic_auth(user='user', passwd='passwd'): return dict(authenticated=True, user=user) +@app.route('/hidden-basic-auth//') +@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()