Remove jwt validation for jschorr to fix later

Refactor oauth validate method to take config over entire appconfig
This commit is contained in:
Sam Chow 2018-06-01 11:31:19 -04:00
parent 7df8ed4a60
commit 301cc6992a
27 changed files with 136 additions and 76 deletions

View file

@ -405,7 +405,7 @@ class SuperUserConfigValidate(ApiResource):
# this is also safe since this method does not access any information not given in the request.
if not config_provider.config_exists() or SuperUserPermission().can():
config = request.get_json()['config']
validator_context = ValidatorContext.from_app(config, request.get_json().get('password', ''), app,
validator_context = ValidatorContext.from_app(app, config, request.get_json().get('password', ''),
ip_resolver=ip_resolver,
config_provider=config_provider)

View file

@ -12,7 +12,7 @@ from peewee import IntegrityError
import features
from app import (app, billing as stripe, authentication, avatar, user_analytics, all_queues,
oauth_login, namespace_gc_queue, ip_resolver)
oauth_login, namespace_gc_queue, ip_resolver, url_scheme_and_hostname)
from auth import scopes
from auth.auth_context import get_authenticated_user
@ -784,7 +784,7 @@ class ExternalLoginInformation(ApiResource):
try:
login_scopes = login_service.get_login_scopes()
auth_url = login_service.get_auth_url(app.config, redirect_suffix, csrf_token, login_scopes)
auth_url = login_service.get_auth_url(url_scheme_and_hostname, redirect_suffix, csrf_token, login_scopes)
return {'auth_url': auth_url}
except DiscoveryFailureException as dfe:
logger.exception('Could not discovery OAuth endpoint information')

View file

@ -8,7 +8,7 @@ from peewee import IntegrityError
import features
from app import app, analytics, get_app_url, oauth_login, authentication
from app import app, analytics, get_app_url, oauth_login, authentication, url_scheme_and_hostname
from auth.auth_context import get_authenticated_user
from auth.decorators import require_session_login
from data import model
@ -250,7 +250,7 @@ def _register_service(login_service):
# Redirect to the normal OAuth flow again, so that the user can now create an account.
csrf_token = generate_csrf_token(OAUTH_CSRF_TOKEN_NAME)
login_scopes = login_service.get_login_scopes()
auth_url = login_service.get_auth_url(app.config, '', csrf_token, login_scopes)
auth_url = login_service.get_auth_url(url_scheme_and_hostname, '', csrf_token, login_scopes)
return redirect(auth_url)
@require_session_login