Store Blender ID OAuth scopes in MongoDB + request badge scope too

This also changes the way we treat Blender ID tokens. Before, the Blender ID
token was discarded and a random token was generated & stored. Now the
actual Blender ID token is stored.

The Facebook and Google OAuth code still uses the old approach of generating
a new token. Not sure what the added value is, though, because once the
Django session is gone there is nothing left to authenticate the user and
thus the random token is useless anyway.
This commit is contained in:
2018-09-11 15:36:25 +02:00
parent 6bcce87bb9
commit 0983474e76
6 changed files with 46 additions and 11 deletions

View File

@@ -69,7 +69,7 @@ class AuthenticationTests(AbstractPillarTest):
@responses.activate
def test_validate_token__force_not_logged_in(self):
from pillar.api.utils import authentication as auth
from pillar.auth import UserClass, current_user
from pillar.auth import UserClass
with self.app.test_request_context():
from flask import g
@@ -160,8 +160,7 @@ class AuthenticationTests(AbstractPillarTest):
def test_save_own_user(self):
"""Tests that a user can't change their own fields."""
from pillar.api.utils import authentication as auth
from pillar.api.utils import PillarJSONEncoder, remove_private_keys
from pillar.api.utils import remove_private_keys
user_id = self.create_user(roles=['subscriber'], token='token')