From 2a1b70c210ddaabbdd54a74f3dfb739da70ef9ff Mon Sep 17 00:00:00 2001 From: chaoflow Date: Sat, 8 Nov 2008 01:51:56 +0000 Subject: [PATCH] paula: WIP: added CredentialsPlugin back again git-svn-id: https://svn.plone.org/svn/collective/paula/trunk@75270 db7f04ef-aaf3-0310-a811-c281ed44c4ad --- .../src/paula/authentication/pauplugins.py | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/paula.authentication/src/paula/authentication/pauplugins.py b/paula.authentication/src/paula/authentication/pauplugins.py index e664f3e..66f17d4 100644 --- a/paula.authentication/src/paula/authentication/pauplugins.py +++ b/paula.authentication/src/paula/authentication/pauplugins.py @@ -147,3 +147,41 @@ class LocalAuthenticatorPlugin( # ComponentLookupError... # """ # return getUtility(IAuthProviders, context=getSite()) + + +class CredentialsFromMappingPlugin(Contained): + """Just returns a mapping it is passed + + Useful, if you use paula and PAU just for authentication but not for + challenging, i.e./e.g. from PlonePAS you already get the credentials in a + mapping and don't need to bother with challenging. + + May be registered globally, as only functionality is implemented. + + >>> cp = CredentialsFromMappingPlugin() + >>> m = UserDict() + >>> c = cp.extractCredentials(m) + >>> c is m + True + >>> IRequest.providedBy(m) + True + """ + implements(ICredentialsFromMappingPlugin) + + def extractCredentials(self, mapping): + """ + """ + # tune the mapping, PAU needs an IRequest to find its factories + # If this does not work, better let the AttributeError go here, than + # later in the getMultiAdapter lookup of PAU + if not IRequest.providedBy(mapping): + alsoProvides(mapping, IRequest) + + return mapping + + def challenge(self, request): + pass # challenge is a no-op for this plugin + + def logout(self, request): + pass # logout is a no-op for this plugin + -- 2.11.4.GIT