Initial work on V2 of the Auth API, also fixes for V1

This commit is contained in:
2011-01-09 13:01:29 +00:00
parent 44547695f6
commit 7be1f97cba
4 changed files with 38 additions and 16 deletions

View File

@@ -1,14 +1,14 @@
from django.conf.urls.defaults import *
from piston.resource import Resource
from piston.authentication import HttpBasicAuthentication, OAuthAuthentication, NoAuthentication
from piston.authentication import NoAuthentication
from api.auth import APIKeyAuthentication
from api.handlers import *
oauth = {'authentication': OAuthAuthentication() }
noauth = {'authentication': NoAuthentication() }
apikeyauth = {'authentication': APIKeyAuthentication() }
# v1 APIs
user_resource = Resource(handler=UserHandler, **apikeyauth)
login_resource = Resource(handler=LoginHandler, **noauth)
eveapi_resource = Resource(handler=EveAPIHandler, **apikeyauth)
@@ -27,8 +27,9 @@ urlpatterns = patterns('',
url(r'^blacklist/$', blacklist_resource),
)
urlpatterns += patterns('piston.authentication',
url(r'^oauth/request_token/$','oauth_request_token'),
url(r'^oauth/authorize/$','oauth_user_auth'),
url(r'^oauth/access_token/$','oauth_access_token'),
# v2 APIs
v2_authenticate_resource = Resource(handler=AuthenticationHandler, **noauth)
urlpatterns += patterns('',
url(r'^v2/authenticate/$', v2_authenticate_resource),
)