Current Path : /usr/lib/python2.7/dist-packages/twisted/cred/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyc |
[XMc @ s d d l Z d d l m Z m Z m Z d d l m Z d d l m Z m Z d d l m Z m Z d e f d YZ d Z d d d YZ d d d YZ d d d YZ d d d YZ e Z d S( iN( t implementst Interfacet Attribute( t defer( t failuret log( t errort credentialst ICredentialsCheckerc B s# e Z d Z e d Z d Z RS( sB An object that can check sub-interfaces of ICredentials. sK A list of sub-interfaces of ICredentials which specifies which I may check.c C s d S( s @param credentials: something which implements one of the interfaces in self.credentialInterfaces. @return: a Deferred which will fire a string which identifies an avatar, an empty tuple to specify an authenticated anonymous user (provided as checkers.ANONYMOUS) or fire a Failure(UnauthorizedLogin). Alternatively, return the result itself. @see: L{twisted.cred.credentials} N( ( R ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyt requestAvatarId s ( t __name__t __module__t __doc__R t credentialInterfacesR ( ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyR s t AllowAnonymousAccessc B s' e Z e e e j f Z d Z RS( c C s t j t S( N( R t succeedt ANONYMOUS( t selfR ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyR 8 s ( R R R R R t IAnonymousR R ( ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyR 4 s t' InMemoryUsernamePasswordDatabaseDontUsec B sN e Z d Z e e e j e j f Z d Z d Z d Z d Z RS( sk An extremely simple credentials checker. This is only of use in one-off test programs or examples which don't want to focus too much on how credentials are verified. You really don't want to use this for anything else. It is, at best, a toy. If you need a simple credentials checker for a real application, see L{FilePasswordDB}. c K s | | _ d S( N( t users( R R ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyt __init__M s c C s | | j | <d S( N( R ( R t usernamet password( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyt addUserP s c C s! | r | St j t j Sd S( N( R t FailureR t UnauthorizedLogin( R t matchedR ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyt _cbPasswordMatchS s c C s^ | j | j k rG t j | j | j | j j | j t | j St j t j Sd S( N( R R R t maybeDeferredt checkPasswordt addCallbackR t strt failR R ( R R ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyR Y s ( R R R R R R t IUsernamePasswordt IUsernameHashedPasswordR R R R R ( ( ( s9 /usr/lib/python2.7/dist-packages/twisted/cred/checkers.pyR <