Skip to content

Commit 7fc2845

Browse files
author
Roland Hedberg
committed
Merge pull request #50 from ccooper21/issue-33
Issue #33: Made necessary changes to work with "repoze.who" v2.0
2 parents f38f1f8 + b8243a1 commit 7fc2845

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def run_tests(self):
4242
'requests >= 1.0.0',
4343
'paste',
4444
'zope.interface',
45-
'repoze.who >= 1.0.18',
45+
'repoze.who',
4646
'm2crypto'
4747
]
4848

src/s2repoze/plugins/sp.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
from repoze.who.interfaces import IChallenger, IIdentifier, IAuthenticator
3838
from repoze.who.interfaces import IMetadataProvider
39-
from repoze.who.plugins.form import FormPluginBase
4039

4140
from saml2 import ecp, BINDING_HTTP_REDIRECT
4241
from saml2 import BINDING_HTTP_POST
@@ -66,7 +65,6 @@ def construct_came_from(environ):
6665
return came_from
6766

6867

69-
# FormPluginBase defines the methods remember and forget
7068
def cgi_field_storage_to_dict(field_storage):
7169
"""Get a plain dictionary, rather than the '.value' system used by the
7270
cgi module."""
@@ -118,14 +116,12 @@ def __call__(self, environ, start_response):
118116
return [self.content]
119117

120118

121-
class SAML2Plugin(FormPluginBase):
119+
class SAML2Plugin(object):
122120

123121
implements(IChallenger, IIdentifier, IAuthenticator, IMetadataProvider)
124122

125123
def __init__(self, rememberer_name, config, saml_client, wayf, cache,
126124
sid_store=None, discovery="", idp_query_param=""):
127-
FormPluginBase.__init__(self)
128-
129125
self.rememberer_name = rememberer_name
130126
self.wayf = wayf
131127
self.saml_client = saml_client
@@ -145,6 +141,24 @@ def __init__(self, rememberer_name, config, saml_client, wayf, cache,
145141
self.outstanding_queries = {}
146142
self.iam = platform.node()
147143

144+
145+
def _get_rememberer(self, environ):
146+
rememberer = environ['repoze.who.plugins'][self.rememberer_name]
147+
return rememberer
148+
149+
150+
#### IIdentifier ####
151+
def remember(self, environ, identity):
152+
rememberer = self._get_rememberer(environ)
153+
return rememberer.remember(environ, identity)
154+
155+
156+
#### IIdentifier ####
157+
def forget(self, environ, identity):
158+
rememberer = self._get_rememberer(environ)
159+
return rememberer.forget(environ, identity)
160+
161+
148162
def _get_post(self, environ):
149163
"""
150164
Get the posted information

0 commit comments

Comments
 (0)