예제 #1
0
def createPAU(event):
    """ Create a pau (pluggable authentication utility, a signup
    principal folder in it and a manger user (!)."""
    sm = event.object.getSiteManager()

    sm['default']['pau'] = pau = PluggableAuthentication()
    pau.prefix = 'pau.'

    pau['signup_principal_folder'] = folder = SignupPrincipalFolder()
    pau.authenticatorPlugins = [folder.__name__]
    folder.prefix = u"users."
    folder.signup_roles = [u'quotationtool.Member']

    principal_id = folder.signUp('admin', 'Op3n', 'Quotationtool Manager')
    role_manager = IPrincipalRoleManager(event.object)
    role_manager = removeSecurityProxy(role_manager)
    role_manager.assignRoleToPrincipal('quotationtool.Manager', principal_id)

    pau['SessionCredentialsPlugin'] = session_creds = SessionCredentialsPlugin()
    pau.credentialsPlugins = [session_creds.__name__]
    session_creds.loginpagename = u"loginForm.html"
    loginfield = u"login"
    passwordfield = u"password"

    sm.registerUtility(pau, IAuthentication)
예제 #2
0
파일: tests.py 프로젝트: grodniewicz/oship
    def test_logout(self):
        plugin = SessionCredentialsPlugin()

        self.assertEqual(plugin.logout(base.TestRequest('/')), False)
예제 #3
0
파일: tests.py 프로젝트: grodniewicz/oship
    def test_challenge(self):
        plugin = SessionCredentialsPlugin()

        self.assertEqual(plugin.challenge(base.TestRequest('/')), False)
예제 #4
0
파일: tests.py 프로젝트: grodniewicz/oship
    def test_exeractCredentials(self):
        plugin = SessionCredentialsPlugin()

        self.assertEqual(plugin.extractCredentials(base.TestRequest('/')), None)