Python twisted.cred.portal.IRealm() Examples
The following are 11
code examples of twisted.cred.portal.IRealm().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
twisted.cred.portal
, or try the search function
.
Example #1
Source File: textserver.py From imaginary with MIT License | 6 votes |
def buildTerminalProtocol(self, viewer): """ Create and return a L{TextServer} using a L{Player} owned by the store this item is in. This implementation is certainly wrong. It probably reflects some current limitations of Mantissa. Primarily, the limitation is interaction between different stores, in this case a user store and an application store. """ # XXX Get the Imaginary app store. Eventually this should just be # self.store. See #2908. imaginary = IRealm(self.store.parent).accountByAddress(u'Imaginary', None).avatars.open() role = viewer.roleIn(imaginary) characters = self._charactersForViewer(imaginary, role) world = imaginary.findUnique(ImaginaryWorld) return CharacterSelectionTextServer(role, world, characters)
Example #2
Source File: test_ftp.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_interface(self): """ L{ftp.BaseFTPRealm} implements L{IRealm}. """ self.assertTrue(verifyClass(IRealm, ftp.BaseFTPRealm))
Example #3
Source File: test_ftp.py From learn_python3_spider with MIT License | 5 votes |
def test_interface(self): """ L{ftp.BaseFTPRealm} implements L{IRealm}. """ self.assertTrue(verifyClass(IRealm, ftp.BaseFTPRealm))
Example #4
Source File: maildir.py From python-for-android with Apache License 2.0 | 5 votes |
def getCredentialsCheckers(self): if self._credcheckers is None: self._credcheckers = [DirdbmDatabase(self.dbm)] return self._credcheckers ## ## IRealm ##
Example #5
Source File: test_ftp.py From python-for-android with Apache License 2.0 | 5 votes |
def test_interface(self): """ L{ftp.BaseFTPRealm} implements L{IRealm}. """ self.assertTrue(verifyClass(IRealm, ftp.BaseFTPRealm))
Example #6
Source File: test_userbase.py From axiom with MIT License | 5 votes |
def logInAndCheck(self, username, domain='localhost'): """ Ensure that logging in via cred succeeds based on the accounts managed by L{axiom.userbase.LoginSystem}. """ s = self.store def _speedup(): l = userbase.LoginSystem(store=s) dependency.installOn(l, s) s.checkpoint() p = Portal(IRealm(s), [ICredentialsChecker(s)]) a = l.addAccount(username, 'localhost', SECRET) gph = GarbageProtocolHandler(store=a.avatars.open(), garbage=0) dependency.installOn(gph, gph.store) return p, gph p, gph = s.transact(_speedup) def wasItGph((interface, avatar, logout)): self.assertEquals(interface, IGarbage) self.assertEquals(avatar, gph) logout() return p.login(UsernamePassword('bob@localhost', SECRET), None, IGarbage ).addCallback(wasItGph)
Example #7
Source File: test_userbase.py From axiom with MIT License | 5 votes |
def _login(self, avatarId, password): cc = ICredentialsChecker(self.store) p = Portal(IRealm(self.store), [cc]) return p.login(UsernamePassword(avatarId, password), None, lambda orig, default: orig)
Example #8
Source File: test_userbase.py From axiom with MIT License | 5 votes |
def test_install(self): """ Create a database, install userbase and check that the store implements L{IRealm} and L{ICredentialsChecker}. i.e. that userbase has been installed. This is an integration test. """ self.userbase('install') self.assertImplements(self.store, IRealm) self.assertImplements(self.store, ICredentialsChecker)
Example #9
Source File: test_userbase.py From axiom with MIT License | 5 votes |
def test_listOffering(self): """ Mantissa offerings are added as users with a 'username' but no domain. Check that the 'list' command prints these correctly. """ name = 'offering-name' self.userbase('install') realm = IRealm(self.store) substoreItem = SubStore.createNew(self.store, ('app', name)) realm.addAccount(name, None, None, internal=True, avatars=substoreItem) output = self.userbase('list') self.assertEquals(output, [name])
Example #10
Source File: test_userbase.py From axiom with MIT License | 5 votes |
def test_powerup(self): """ Test that L{LoginSystem} powers up the store for L{IRealm}. """ self.assertIdentical(self.realm, IRealm(self.store))
Example #11
Source File: test_loginMethod1to2.py From axiom with MIT License | 5 votes |
def testUpgrade(self): p = Portal(IRealm(self.store), [ICredentialsChecker(self.store)]) def loggedIn((interface, avatarAspect, logout)): # if we can login, i guess everything is fine self.assertEquals(avatarAspect.garbage, GARBAGE_LEVEL) creds = UsernamePassword('@'.join(CREDENTIALS[:-1]), CREDENTIALS[-1]) d = p.login(creds, None, IGarbage) return d.addCallback(loggedIn)