MellonAdapter: use django.db.connection instead of StoreRequestMiddleware (#6728)
This commit is contained in:
parent
a0bb6312c6
commit
778235c048
|
@ -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()) ".
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue