Add the ability to use an oauth token to interact with the index and registry.

This commit is contained in:
jakedt 2014-03-20 12:09:25 -04:00
parent 0992c8a47e
commit a9c0e016f3
2 changed files with 46 additions and 29 deletions

View file

@ -7,6 +7,7 @@ from functools import wraps
from collections import OrderedDict
from data import model
from data.model import oauth
from data.queue import webhook_queue
from app import mixpanel, app
from auth.auth import process_auth
@ -78,6 +79,13 @@ def create_user():
except model.InvalidTokenException:
abort(400, 'Invalid access token.', issue='invalid-access-token')
elif username == '$oauthtoken':
validated = oauth.validate_access_token(password)
if validated is not None:
return success
else:
abort(400, 'Invalid oauth access token.', issue='invalid-oauth-access-token')
elif '+' in username:
try:
model.verify_robot(username, password)