From f33ab053d47089ce47946688488cab8cc4a11bf2 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 5 Aug 2014 18:19:33 +0200 Subject: [PATCH] adapters: add implementation of get_idp() to the DefaultAdapter class --- mellon/adapters.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mellon/adapters.py b/mellon/adapters.py index 53318ff..d748d5d 100644 --- a/mellon/adapters.py +++ b/mellon/adapters.py @@ -4,11 +4,17 @@ from django.core.exceptions import PermissionDenied from django.contrib import auth from django.contrib.auth.models import Group -from . import utils +from . import utils, app_settings log = logging.getLogger(__name__) class DefaultAdapter(object): + def get_idp(self, entity_id): + '''Find the first IdP definition matching entity_id''' + for idp in app_settings.IDENTITY_PROVIDERS: + if entity_id in idp['ENTITY_ID']: + return idp + def authorize(self, idp, saml_attributes): if not idp: return False