Remove Flask-OAuthlib and oauth_blender_id from Pillar

We switch completely to a rauth-based approach, allowing multiple providers for authentication.
This commit is contained in:
2017-08-18 18:34:10 +02:00
parent 6e9a539d61
commit 6b3e523036
6 changed files with 34 additions and 64 deletions

View File

@@ -6,7 +6,6 @@ import typing
from flask import session, g
import flask_login
import flask_oauthlib.client
from werkzeug.local import LocalProxy
from pillar import current_app
@@ -222,35 +221,6 @@ def get_blender_id_oauth_token():
return None
def config_oauth_login(app):
config = app.config
if not config.get('SOCIAL_BLENDER_ID'):
log.info('OAuth Blender-ID login not set up, no app config SOCIAL_BLENDER_ID.')
return None
if not config.get('BLENDER_ID_OAUTH_URL'):
log.error('Unable to use Blender ID, missing configuration BLENDER_ID_OAUTH_URL.')
return None
oauth = flask_oauthlib.client.OAuth(app)
social_blender_id = config.get('SOCIAL_BLENDER_ID')
oauth_blender_id = oauth.remote_app(
'blender_id',
consumer_key=social_blender_id['app_id'],
consumer_secret=social_blender_id['app_secret'],
request_token_params={'scope': 'email'},
base_url=config['BLENDER_ID_OAUTH_URL'],
request_token_url=None,
access_token_url=config['BLENDER_ID_BASE_ACCESS_TOKEN_URL'],
authorize_url=config['BLENDER_ID_AUTHORIZE_URL']
)
oauth_blender_id.tokengetter(get_blender_id_oauth_token)
log.info('OAuth Blender-ID login setup as %s', social_blender_id['app_id'])
return oauth_blender_id
def _get_current_user() -> UserClass:
"""Returns the current user as a UserClass instance.