aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken/urls.py
diff options
context:
space:
mode:
authorRob Romano2012-11-10 16:09:14 -0800
committerRob Romano2012-11-10 16:09:14 -0800
commite029e44477111ed16da8954a53dcf08c08cfb403 (patch)
tree60a039e3bc9f4c1aa13587d2a86a9480fee02827 /rest_framework/authtoken/urls.py
parentf9a9ff1db08f5ed8c765569fb936b21d5c6def6c (diff)
downloaddjango-rest-framework-e029e44477111ed16da8954a53dcf08c08cfb403.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'),
+)