aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken/urls.py
diff options
context:
space:
mode:
authorRob Romano2012-11-10 16:09:14 -0800
committerRob Romano2012-11-14 12:46:14 -0800
commit4a2526bd1e067104a1553a3e158016fe9ad285bb (patch)
tree6ef8aadae8ee7c60b962db55eb6788b7d9b32e87 /rest_framework/authtoken/urls.py
parent647abcdb16105c51d3414d2da840aeb93b290ef9 (diff)
downloaddjango-rest-framework-4a2526bd1e067104a1553a3e158016fe9ad285bb.tar.bz2
Added authtoken login/logout urlpatterns and views to support scripted logins and logouts using TokenAuthentication. Added unittests.
Diffstat (limited to 'rest_framework/authtoken/urls.py')
-rw-r--r--rest_framework/authtoken/urls.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/rest_framework/authtoken/urls.py b/rest_framework/authtoken/urls.py
new file mode 100644
index 00000000..2a3e8115
--- /dev/null
+++ b/rest_framework/authtoken/urls.py
@@ -0,0 +1,21 @@
+"""
+Login and logout views for token authentication.
+
+Add these to your root URLconf if you're using token authentication
+your API requires authentication.
+
+The urls must be namespaced as 'rest_framework', and you should make sure
+your authentication settings include `TokenAuthentication`.
+
+ urlpatterns = patterns('',
+ ...
+ url(r'^auth-token', include('rest_framework.authtoken.urls', namespace='rest_framework'))
+ )
+"""
+from django.conf.urls.defaults import patterns, url
+from rest_framework.authtoken.views import AuthTokenView
+
+urlpatterns = patterns('rest_framework.authtoken.views',
+ url(r'^login/$', AuthTokenView.as_view(), name='token_login'),
+# url(r'^logout/$', 'token_logout', name='token_logout'),
+)