U
    
W[S  ã                   @   sŠ   d Z ddlmZmZ ddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZ d	Zd
ZeeejƒG dd„ deƒƒZeƒ ZdS )z;
Cred plugin for a file of the format 'username:password'.
é    )Úabsolute_importÚdivisionN)Úimplementer)Úplugin)ÚFilePasswordDB)ÚICheckerFactory)ÚIUsernamePasswordÚIUsernameHashedPasswordz¶
This checker expects to receive the location of a file that
conforms to the FilePasswordDB format. Each line in the file
should be of the format 'username:password', in plain text.
zWarning: not a valid filec                   @   s2   e Zd ZdZdZeZdZee	fZ
ejZdd„ ZdS )ÚFileCheckerFactoryz7
    A factory for instances of L{FilePasswordDB}.
    Úfilez,Location of a FilePasswordDB-formatted file.c                 C   sL   ddl m} | ¡ s$td| j ƒ‚n ||ƒ ¡ sD| j dt|f ¡ t	|ƒS )zÝ
        This checker factory expects to get the location of a file.
        The file should conform to the format required by
        L{FilePasswordDB} (using defaults for all
        initialization parameters).
        r   )ÚFilePathz%r requires a filenamez%s: %s
)
Ztwisted.python.filepathr   ÚstripÚ
ValueErrorÚauthTypeÚisfileÚerrorOutputÚwriteÚinvalidFileWarningr   )ÚselfZ	argstringr   © r   ú;/usr/lib/python3/dist-packages/twisted/plugins/cred_file.pyÚgenerateChecker-   s    z"FileCheckerFactory.generateCheckerN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚfileCheckerFactoryHelpZauthHelpZargStringFormatr   r	   ZcredentialInterfacesÚsysÚstderrr   r   r   r   r   r   r
       s   r
   )r   Z
__future__r   r   r   Zzope.interfacer   Ztwistedr   Ztwisted.cred.checkersr   Ztwisted.cred.strcredr   Ztwisted.cred.credentialsr   r	   r   r   ZIPluginÚobjectr
   ZtheFileCheckerFactoryr   r   r   r   Ú<module>   s   
