MellonAdapter: use django.db.connection instead of StoreRequestMiddleware (#6728)

This commit is contained in:
Thomas NOËL 2015-03-13 14:50:42 +01:00
parent a0bb6312c6
commit 778235c048
2 changed files with 2 additions and 8 deletions

View File

@ -125,8 +125,5 @@ provider in the hobo.json and use that for authentication.
MELLON_ADAPTER = ('hobo.multitenant.mellon.MellonAdapter',)
It requires hobo.middleware.utils.StoreRequestMiddleware to be added to the
MIDDLEWARE_CLASSES.
In the service login view, the code path to mellon can thus dynamically be
chosen, using " if any(mellon.utils.get_idps()) ".

View File

@ -5,15 +5,12 @@ import os
from mellon.adapters import DefaultAdapter
from hobo.middleware.utils import StoreRequestMiddleware
from django.db import connection
class MellonAdapter(DefaultAdapter):
def get_idp(self, entity_id):
request = StoreRequestMiddleware.get_request()
if not request:
return None
tenant_dir = request.tenant.get_directory()
tenant_dir = connection.tenant.get_directory()
hobo_json_path = os.path.join(tenant_dir, 'hobo.json')
hobo_json = json.load(file(hobo_json_path))
# always look for the first active identity provider in the list of