~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/conch/credentials.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-01-16 19:56:10 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060116195610-ykmxbia4mnnod9o2
Tags: 2.1.0-0ubuntu2
debian/copyright: Include copyright for python 2.3; some 2.3 files
are included in the upstream tarball, but not in the binary packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from twisted.cred import credentials
2
 
from twisted.python import components
3
 
from zope import interface
4
 
 
5
 
class ISSHPrivateKey(credentials.ICredentials):
6
 
    """I encapsulate an SSH public key to be checked against a users private
7
 
    key.
8
 
 
9
 
    @ivar username: Duh?
10
 
 
11
 
    @ivar blob: The public key blob as sent by the client.
12
 
 
13
 
    @ivar sigData: The data the signature was made from.
14
 
 
15
 
    @ivar signature: The signed data.  This is checked to verify that the user
16
 
                     owns the private key.
17
 
    
18
 
    """
19
 
 
20
 
class SSHPrivateKey:
21
 
    interface.implements(ISSHPrivateKey)
22
 
    def __init__(self, username, blob, sigData, signature):
23
 
        self.username = username
24
 
        self.blob = blob
25
 
        self.sigData = sigData
26
 
        self.signature = signature
27
 
 
28
 
components.backwardsCompatImplements(SSHPrivateKey)
29
 
 
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).
34
 
 
35
 
    @ivar username: The username for the user being logged in.
36
 
 
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.
43
 
    """
44
 
 
45
 
class PluggableAuthenticationModules:
46
 
    interface.implements(IPluggableAuthenticationModules)
47
 
 
48
 
    def __init__(self, username, pamConversion):
49
 
        self.username = username
50
 
        self.pamConversion = pamConversion
51
 
 
52
 
components.backwardsCompatImplements(PluggableAuthenticationModules)
53
 
 
54
 
IUsernamePassword = credentials.IUsernamePassword
55
 
UsernamePassword = credentials.UsernamePassword