Auth: also support Bearer token authentication
This is commonly used in OAuth-authenticated calls, and can help us break away from the username-is-auth-token stuff currently in use.
This commit is contained in:
parent
3ea2504e8c
commit
199c6b1f77
@ -118,9 +118,13 @@ def validate_token():
|
||||
|
||||
from pillar.auth import AnonymousUser
|
||||
|
||||
auth_header = request.headers.get('Authorization') or ''
|
||||
if request.authorization:
|
||||
token = request.authorization.username
|
||||
oauth_subclient = request.authorization.password
|
||||
elif auth_header.startswith('Bearer '):
|
||||
token = auth_header[7:].strip()
|
||||
oauth_subclient = ''
|
||||
else:
|
||||
# Check the session, the user might be logged in through Flask-Login.
|
||||
from pillar import auth
|
||||
|
Loading…
x
Reference in New Issue
Block a user