文件操作 - cred_memory.cpython-310.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/twisted/plugins/__pycache__/cred_memory.cpython-310.pyc
编辑文件内容
o �b� � @ sl d Z ddlmZ ddlmZ ddlmZ ddlmZm Z ddl mZ dZeeej �G dd � d ��Ze� Zd S )z- Cred plugin for an in-memory user database. � )�implementer)�plugin)�'InMemoryUsernamePasswordDatabaseDontUse)�IUsernameHashedPassword�IUsernamePassword)�ICheckerFactoryz� A checker that uses an in-memory user database. 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 a toy. c @ s, e Zd ZdZdZeZdZee fZ dd� ZdS )�InMemoryCheckerFactorya~ A factory for in-memory credentials checkers. 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{cred_file.FileCheckerFactory}. �memoryz*A colon-separated list (name:password:...)c C sp t � }|r6|�d�}t|�d rddlm} |d��tdt|�d�D ]}|| ||d }}|�||� q"|S )a This checker factory expects to get a list of username:password pairs, with each pair also separated by a colon. For example, the string 'alice:f:bob:g' would generate two users, one named 'alice' and one named 'bob'. �:� r )�InvalidAuthArgumentStringz#argstring must be in format U:P:...� )r �split�len�twisted.cred.strcredr �range�addUser)�self� argstring�checker�piecesr �i�username�password� r �=/usr/lib/python3/dist-packages/twisted/plugins/cred_memory.py�generateChecker- s z&InMemoryCheckerFactory.generateCheckerN)�__name__� __module__�__qualname__�__doc__�authType�inMemoryCheckerFactoryHelp�authHelp�argStringFormatr r �credentialInterfacesr r r r r r s r N)r �zope.interfacer �twistedr �twisted.cred.checkersr �twisted.cred.credentialsr r r r r"