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

« back to all changes in this revision

Viewing changes to twisted/cred/credentials.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# See LICENSE for details.
5
5
 
6
6
 
7
 
from twisted.python import components
8
 
from zope import interface
 
7
from zope.interface import implements, Interface
9
8
 
10
9
import hmac
11
10
import time
12
11
import random
13
12
 
14
 
class ICredentials(components.Interface):
 
13
class ICredentials(Interface):
15
14
    """I check credentials.
16
15
 
17
16
    Implementors _must_ specify which sub-interfaces of ICredentials
32
31
    @ivar username: The username associated with these credentials.
33
32
    """
34
33
 
35
 
    def checkPassword(self, password):
 
34
    def checkPassword(password):
36
35
        """Validate these credentials against the correct password.
37
36
 
38
37
        @param password: The correct, plaintext password against which to
59
58
    @ivar password: The password associated with these credentials.
60
59
    """
61
60
 
62
 
    def checkPassword(self, password):
 
61
    def checkPassword(password):
63
62
        """Validate these credentials against the correct password.
64
63
 
65
64
        @param password: The correct, plaintext password against which to
76
75
 
77
76
 
78
77
class CramMD5Credentials:
79
 
    interface.implements(IUsernameHashedPassword)
 
78
    implements(IUsernameHashedPassword)
80
79
 
81
80
    challenge = ''
82
81
    response = ''
110
109
 
111
110
 
112
111
class UsernameHashedPassword:
113
 
    interface.implements(IUsernameHashedPassword)
 
112
    implements(IUsernameHashedPassword)
114
113
 
115
114
    def __init__(self, username, hashed):
116
115
        self.username = username
121
120
 
122
121
 
123
122
class UsernamePassword:
124
 
    interface.implements(IUsernamePassword)
 
123
    implements(IUsernamePassword)
125
124
 
126
125
    def __init__(self, username, password):
127
126
        self.username = username
132
131
 
133
132
 
134
133
class Anonymous:
135
 
    interface.implements(IAnonymous)
 
134
    implements(IAnonymous)
136
135
 
137
136
 
138
137
class ISSHPrivateKey(ICredentials):
152
151
 
153
152
    """
154
153
class SSHPrivateKey:
155
 
    interface.implements(ISSHPrivateKey)
 
154
    implements(ISSHPrivateKey)
156
155
    def __init__(self, username, algName, blob, sigData, signature):
157
156
        self.username = username
158
157
        self.algName = algName
177
176
    """
178
177
 
179
178
class PluggableAuthenticationModules:
180
 
    interface.implements(IPluggableAuthenticationModules)
 
179
    implements(IPluggableAuthenticationModules)
181
180
    
182
181
    def __init__(self, username, pamConversion):
183
182
        self.username = username