Re: [Zope3-Users] Creating PluggableAuthentication problem.
I try to add a PluggableAuthentication and a PrincipalFolder automatically. When I add a principal to the PrincipalFolder it works fine, but the authentification of the User fails. When I add one more PluggableAuthentication manually and choose the automatically generated PrincipalFolder as authenticator plugin, it works. Did you have a look at this thread: http://www.opensubscriber.com/message/zope3-users@zope.org/3786410.html There I pasted an example how I did it. Thank you, I have tried this example: ensureUtility(bare, IAuthentication, '', PluggableAuthentication, name='pau', copy_to_zlog=False) pau = zapi.getUtility(IAuthentication, name='pau', context=self.context) pf = PrincipalFolder() pau['PrincipalFolder'] = pf pf_reg = UtilityRegistration(u'users', IAuthenticatorPlugin, pf) pau.registrationManager.addRegistration(pf_reg) pf_reg.status = ActiveStatus pau.authenticatorPlugins = (u'users',) pau.credentialsPlugins = (u'Zope Realm Basic-Auth',) But I have the same problem descriped above. Its frustating. There must be a trick to get it work. Tobias ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Creating PluggableAuthentication problem.
Tobias Weber wrote: Hello! I try to add a PluggableAuthentication and a PrincipalFolder automatically. When I add a principal to the PrincipalFolder it works fine, but the authentification of the User fails. When I add one more PluggableAuthentication manually and choose the automatically generated PrincipalFolder as authenticator plugin, it works. Here is my code: [...] I am sorry for this code, I try to figure out how it works. Did you have a look at this thread: http://www.opensubscriber.com/message/zope3-users@zope.org/3786410.html There I pasted an example how I did it. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Creating PluggableAuthentication problem.
Hello! I try to add a PluggableAuthentication and a PrincipalFolder automatically. When I add a principal to the PrincipalFolder it works fine, but the authentification of the User fails. When I add one more PluggableAuthentication manually and choose the automatically generated PrincipalFolder as authenticator plugin, it works. Here is my code: from zope.app import zapi from zope.app.publisher.browser import BrowserView from zope.security.proxy import removeSecurityProxy from zope.app.component.interfaces import ISite from zope.app.component.site import LocalSiteManager from zope.app.authentication.authentication import PluggableAuthentication from zope.app.component.site import UtilityRegistration from zope.app.security.interfaces import IAuthentication from zope.app.container.interfaces import INameChooser from zope.app.component.interfaces.registration import ActiveStatus from zope.app.authentication.principalfolder import PrincipalFolder from zope.app.authentication.interfaces import IAuthenticatorPlugin class MakeUserFolder(BrowserView): def addUserFolder(self): if ISite.providedBy(self.context): raise zapi.UserError('This is already a site') # We don't want to store security proxies (we can't, # actually), so we have to remove proxies here before passing # the context to the SiteManager. bare = removeSecurityProxy(self.context) sm = LocalSiteManager(bare) self.context.setSiteManager(sm) # create PluggableAuthentication utility pluggableauth = PluggableAuthentication() pluggableauth.prefix = u'learn2l' # get site manager and site management folder sitemanager = bare.getSiteManager() default = sitemanager['default'] # add utility to site management folder chooser = INameChooser(default) folder_name = chooser.chooseName(pluggableauth.__name__, pluggableauth) default[folder_name] = pluggableauth # create service registration registration = UtilityRegistration('pluggableauth', IAuthentication, pluggableauth) key = default.registrationManager.addRegistration(registration) zapi.traverse(default.registrationManager, key).status = ActiveStatus # create PrincipalFolder utility pf = PrincipalFolder() pf.prefix = u'users' # add utility to PuggableAuthentication chooser = INameChooser(pluggableauth) folder_name = chooser.chooseName(pf.__name__, pf) pluggableauth[folder_name] = pf # create service registration registration = UtilityRegistration('users', IAuthenticatorPlugin, pf) key = pluggableauth.registrationManager.addRegistration(registration) zapi.traverse(pluggableauth.registrationManager, key).status = ActiveStatus pluggableauth.authenticatorPlugins = [u'users'] pluggableauth.credentialsPlugins = [u'Zope Realm Basic-Auth'] self.request.response.redirect(.) I am sorry for this code, I try to figure out how it works. Thank you, Tobias ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users