1
from twisted.cred import credentials
2
from twisted.python import components
3
from zope import interface
5
class ISSHPrivateKey(credentials.ICredentials):
6
"""I encapsulate an SSH public key to be checked against a users private
11
@ivar blob: The public key blob as sent by the client.
13
@ivar sigData: The data the signature was made from.
15
@ivar signature: The signed data. This is checked to verify that the user
21
interface.implements(ISSHPrivateKey)
22
def __init__(self, username, blob, sigData, signature):
23
self.username = username
25
self.sigData = sigData
26
self.signature = signature
28
components.backwardsCompatImplements(SSHPrivateKey)
30
class IPluggableAuthenticationModules(credentials.ICredentials):
31
"""I encapsulate the authentication of a user via PAM (Pluggable
32
Authentication Modules. I use PyPAM (available from
33
http://www.tummy.com/Software/PyPam/index.html).
35
@ivar username: The username for the user being logged in.
37
@ivar pamConversion: A function that is called with a list of tuples
38
(message, messageType). See the PAM documentation
39
for the meaning of messageType. The function
40
returns a Deferred which will fire with a list
41
of (response, 0), one for each message. The 0 is
42
currently unused, but is required by the PAM library.
45
class PluggableAuthenticationModules:
46
interface.implements(IPluggableAuthenticationModules)
48
def __init__(self, username, pamConversion):
49
self.username = username
50
self.pamConversion = pamConversion
52
components.backwardsCompatImplements(PluggableAuthenticationModules)
54
IUsernamePassword = credentials.IUsernamePassword
55
UsernamePassword = credentials.UsernamePassword