Your IP : 216.73.216.213
B
:��]� � @ s� d Z ddlmZmZ ddlZddlmZmZ ddlm Z ddl
mZ G dd� de�ZG d d
� d
e
�ZG dd� de�ZG d
d� de�ZG dd� de�ZdZdd� Zdd� Zdd� ZG dd� d�ZdS )z�
Support for resolving command-line strings that represent different
checkers available to cred.
Examples:
- passwd:/etc/passwd
- memory:admin:asdf:user:lkj
- unix
� )�absolute_import�divisionN)� Interface� Attribute)�
getPlugins)�usagec @ s8 e Zd ZdZed�Zed�Zed�Zed�Zdd� Z dS ) �ICheckerFactoryz�
A factory for objects which provide
L{twisted.cred.checkers.ICredentialsChecker}.
It's implemented by twistd plugins creating checkers.
z0A tag that identifies the authentication method.zmA detailed (potentially multi-line) description of precisely what functionality this CheckerFactory provides.z=A short (one-line) description of the argument string format.z@A list of credentials interfaces that this factory will support.c C s dS )z}
Return an L{twisted.cred.checkers.ICredentialsChecker} provider using the supplied
argument string.
N� )� argstringr r �G/opt/alt/python37/lib64/python3.7/site-packages/twisted/cred/strcred.py�generateChecker5 s zICheckerFactory.generateCheckerN)
�__name__�
__module__�__qualname__�__doc__r �authType�authHelp�argStringFormat�credentialInterfacesr r r r r r s r c @ s e Zd ZdZdS )�StrcredExceptionz+
Base exception class for strcred.
N)r
r r r r r r r r = s r c @ s e Zd ZdZdS )�InvalidAuthTypezv
Raised when a user provides an invalid identifier for the
authentication plugin (known as the authType).
N)r
r r r r r r r r D s r c @ s e Zd ZdZdS )�InvalidAuthArgumentStringzl
Raised by an authentication plugin when the argument string
provided is formatted incorrectly.
N)r
r r r r r r r r L s r c @ s e Zd ZdZdS )�UnsupportedInterfacesz�
Raised when an application is given a checker to use that does not
provide any of the application's supported credentials interfaces.
N)r
r r r r r r r r T s r z<WARNING: This authType is not supported by this application.c C s t t�S )z=
Find all objects that implement L{ICheckerFactory}.
)r r r r r r �findCheckerFactoriesc s r c C s* xt � D ]}|j| kr|S qW t| ��dS )zJ
Find the first checker factory that supports the given authType.
N)r r r )r �factoryr r r �findCheckerFactoryk s
r c C s0 d| kr| � dd�\}}n| }d}t|��|�S )z�
Returns an L{twisted.cred.checkers.ICredentialsChecker} based on the
contents of a descriptive string. Similar to
L{twisted.application.strports}.
�:� � )�splitr r )�descriptionr r
r r r �makeCheckerv s
r! c @ sR e Zd ZdZdZejZdd� Zdd� Z dd� Z
d d
� Zdd� Zd
d� Z
dd� ZdS )�AuthOptionMixinak
Defines helper methods that can be added on to any
L{usage.Options} subclass that needs authentication.
This mixin implements three new options methods:
The opt_auth method (--auth) will write two new values to the
'self' dictionary: C{credInterfaces} (a dict of lists) and
C{credCheckers} (a list).
The opt_help_auth method (--help-auth) will search for all
available checker plugins and list them for the user; it will exit
when finished.
The opt_help_auth_type method (--help-auth-type) will display
detailed help for a particular checker plugin.
@cvar supportedInterfaces: An iterable object that returns
credential interfaces which this application is able to support.
@cvar authOutput: A writeable object to which this options class
will send all help-related output. Default: L{sys.stdout}
Nc C s | j dkp|| j kS )zR
Returns whether a particular credentials interface is supported.
N)�supportedInterfaces)�self� interfacer r r �supportsInterface� s
z!AuthOptionMixin.supportsInterfacec C s"