%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/cred/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/cred/__pycache__/strcred.cpython-312.pyc

�

Ϫ�f� ����dZddlZddlmZmZmZddlmZmZddl	m
Z
ddlmZGd�de�Z
Gd	�d
e�ZGd�de�ZGd
�de�ZGd�de�ZdZd�Zd�Zd�ZGd�d�Zy)z�
Support for resolving command-line strings that represent different
checkers available to cred.

Examples:
 - passwd:/etc/passwd
 - memory:admin:asdf:user:lkj
 - unix
�N)�Optional�Sequence�Type)�	Attribute�	Interface)�
getPlugins)�usagec�V�eZdZdZed�Zed�Zed�Zed�Zd�Z	y)�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��y)z}
        Return an L{twisted.cred.checkers.ICredentialsChecker} provider using the supplied
        argument string.
        N�)�	argstrings �6/usr/lib/python3/dist-packages/twisted/cred/strcred.py�generateCheckerzICheckerFactory.generateChecker2s��N)
�__name__�
__module__�__qualname__�__doc__r�authType�authHelp�argStringFormat�credentialInterfacesrr
rrrrsG����K�L�H��	;��H�
 �G��O�%�J���rrc��eZdZdZy)�StrcredExceptionz+
    Base exception class for strcred.
    N�rrrrr
rrrr9s��rrc��eZdZdZy)�InvalidAuthTypezv
    Raised when a user provides an invalid identifier for the
    authentication plugin (known as the authType).
    Nrr
rrrr?���rrc��eZdZdZy)�InvalidAuthArgumentStringzl
    Raised by an authentication plugin when the argument string
    provided is formatted incorrectly.
    Nrr
rrr!r!Frrr!c��eZdZdZy)�UnsupportedInterfacesz�
    Raised when an application is given a checker to use that does not
    provide any of the application's supported credentials interfaces.
    Nrr
rrr#r#Mrrr#z<WARNING: This authType is not supported by this application.c� �tt�S)z=
    Find all objects that implement L{ICheckerFactory}.
    )rrr
rr�findCheckerFactoriesr%Ys���o�&�&rc�\�t�D]}|j|k(s�|cSt|��)zJ
    Find the first checker factory that supports the given authType.
    )r%rr)r�factorys  r�findCheckerFactoryr(`s6��(�)������x�'��N���(�
#�#rc�r�d|vr|jdd�\}}n|}d}t|�j|�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)�descriptionrrs   r�makeCheckerr/jsC���k��)�/�/��Q�7���)����	��h�'�7�7�	�B�Brc�t�eZdZUdZdZeeeee	d<e
jZd�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zy)�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}
    N�supportedInterfacesc�>�|jduxs||jvS)zR
        Returns whether a particular credentials interface is supported.
        N)r2)�self�	interfaces  r�supportsInterfacez!AuthOptionMixin.supportsInterface�s%���'�'�4�/�X�9��@X�@X�3X�Xrc�L�|jD]}|j|�s�yy)z�
        Returns whether a checker factory will provide at least one of
        the credentials interfaces that we care about.
        TF)rr6�r4r'r5s   r�supportsCheckerFactoryz&AuthOptionMixin.supportsCheckerFactory�s/��
!�5�5�	�I��%�%�i�0��	�rc�r�g}|j�
|j}n4|jD]%}|j|�s�|j|��'|st	|j��d|vri|d<d|vrg|d<|dj|�|D]&}|dj|g�j|��(y)zM
        Supply a supplied credentials checker to the Options class.
        N�credInterfaces�credCheckers)r2rr6�appendr#�
setdefault)r4�checker�	supportedr5s    r�
addCheckerzAuthOptionMixin.addChecker�s���
�	��#�#�+��4�4�I�$�9�9�
0�	��)�)�)�4��$�$�Y�/�
0��'��(D�(D�E�E��4�'�%'�D�!�"���%�#%�D�� ��^��#�#�G�,�"�	M�I��!�"�-�-�i��<�C�C�G�L�	Mrc�P�	|jt|��y#t$r*}tjd|j
dz��d}~wt$r*}tjd|j
dz��d}~wt$r}tjd|z��d}~wwxYw)zB
        Specify an authentication method for the server.
        zAuth plugin not supported: %srNzAuth plugin not recognized: %szUnexpected error: %s)rAr/r#r	�
UsageError�argsr�	Exception)r4r.�es   r�opt_authzAuthOptionMixin.opt_auth�s���	?��O�O�K��4�5��$�	P��"�"�#B�Q�V�V�A�Y�#N�O�O���	Q��"�"�#C�a�f�f�Q�i�#O�P�P���	?��"�"�#9�A�#=�>�>��	?�s,��	B%�%A�B%�%A<�<B%�B � B%c#�zK�t�D]*}|jD]}|j|�s�|���*�,y�w)z�
        Return a list of which authTypes will be displayed by --help-auth.
        This makes it a lot easier to test this module.
        N)r%rr6r8s   r�_checkerFactoriesForOptHelpAuthz/AuthOptionMixin._checkerFactoriesForOptHelpAuth�sE����
,�-�	�G�$�9�9�
�	��)�)�)�4�!�M��
�	�s�.;�
;c��|jjd�|jjd�|jjd�d}|j�D]0}t|j�|kDs�t|j�}�2d|z}|jj|dz�|jj|dz�|j�D]6}|jj||j|j
fz��8|jjd�t
d��)z<
        Show all authentication methods available.
        z#Usage: --auth AuthType[:ArgString]
z-For detailed help: --help-auth-type AuthType
�
rz
  %%-%is	%%s
)�AuthTypezArgString format)z========z================)�
authOutput�writerI�lenrr�
SystemExit)r4�firstLengthr'�formatStrings    r�
opt_help_authzAuthOptionMixin.opt_help_auth�s��	
�����D�E������N�O������d�#����;�;�=�	4�G��7�#�#�$�{�2�!�'�"2�"2�3��	4�)�;�6�������l�-M�M�N������l�-M�M�N��;�;�=�	�G��O�O�!�!��� 0� 0�'�2I�2I�J�J�
�	�	
�����d�#���m�rc��	t|�}|jjd|z�|jjd|jz�|jjd�|jj�j�D].}|jjd|j�z��0|jjd�|j|�s=|jjdtz�|jjd�td��#t$rtjd|z��wxYw)zA
        Show help for a particular authentication type.
        zInvalid auth type: %szUsage: --auth %s[:ArgString]
zArgString format: %s
rKz  %s
r)r(rr	rCrMrNrr�strip�
splitlines�rstripr9�notSupportedWarningrP)r4r�cf�lines    r�opt_help_auth_typez"AuthOptionMixin.opt_help_auth_type�s��	G�#�H�-�B�	
�����>��I�J������6��9K�9K�K�L������d�#��K�K�%�%�'�2�2�4�	<�D��O�O�!�!�(�T�[�[�]�":�;�	<������d�#��*�*�2�.��O�O�!�!�(�-@�"@�A��O�O�!�!�$�'���m����	G��"�"�#:�X�#E�F�F�	G�s�D;�;"E)rrrrr2rrrr�__annotations__�sys�stdoutrMr6r9rArGrIrSr[r
rrr1r1xsR���0@D���(�4�	�?�";�<�C����J�Y��M�.?�	��,rr1)rr]�typingrrr�zope.interfacerr�twisted.pluginr�twisted.pythonr	rrErrr!r#rXr%r(r/r1r
rr�<module>rcs�����+�+�/�%� ��i��<�y���&��� 0���,��X��'�$�C�B�Br

Zerion Mini Shell 1.0