§
    Ètºf’   ã                   ó
  — d Z ddlZddlmZmZmZ ddlmZmZ ddl	m
Z
 ddlmZ  G d„ de¦  «        Z G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdZd„ Zd„ Zd„ Z G d„ d¦  «        ZdS )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                   óp   — e Zd ZdZ ed¦  «        Z ed¦  «        Z ed¦  «        Z ed¦  «        Zd„ Z	dS )Ú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                 ó   — dS )z}
        Return an L{twisted.cred.checkers.ICredentialsChecker} provider using the supplied
        argument string.
        N© )Ú	argstrings    úS/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/cred/strcred.pyÚgenerateCheckerzICheckerFactory.generateChecker2   s   € € € ó    N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚauthTypeÚauthHelpÚargStringFormatÚcredentialInterfacesr   r   r   r   r   r      s‚   € € € € € ðð ð ˆyÐKÑLÔL€Hàˆyð	;ñô €Hð
  �iØGñô €Oð %˜9ØJñô Ððð ð ð ð r   r   c                   ó   — e Zd ZdZdS )ÚStrcredExceptionz+
    Base exception class for strcred.
    N©r   r   r   r   r   r   r   r   r   9   s   € € € € € ðð ð ð r   r   c                   ó   — e Zd ZdZdS )ÚInvalidAuthTypezv
    Raised when a user provides an invalid identifier for the
    authentication plugin (known as the authType).
    Nr   r   r   r   r   r   ?   ó   € € € € € ðð ð ð r   r   c                   ó   — e Zd ZdZdS )ÚInvalidAuthArgumentStringzl
    Raised by an authentication plugin when the argument string
    provided is formatted incorrectly.
    Nr   r   r   r   r!   r!   F   r   r   r!   c                   ó   — e Zd ZdZdS )ÚUnsupportedInterfacesz“
    Raised when an application is given a checker to use that does not
    provide any of the application's supported credentials interfaces.
    Nr   r   r   r   r#   r#   M   r   r   r#   z<WARNING: This authType is not supported by this application.c                  ó*   — t          t          ¦  «        S )z=
    Find all objects that implement L{ICheckerFactory}.
    )r   r   r   r   r   ÚfindCheckerFactoriesr%   Y   s   € õ •oÑ&Ô&Ð&r   c                 ó`   — t          ¦   «         D ]}|j        | k    r|c S Œt          | ¦  «        ‚)zJ
    Find the first checker factory that supports the given authType.
    )r%   r   r   )r   Úfactorys     r   ÚfindCheckerFactoryr(   `   sC   € õ (Ñ)Ô)ð ð ˆØÔ˜xÒ'Ð'ØˆNˆNˆNð (å
˜(Ñ
#Ô
#Ð#r   c                 óŠ   — d| v r|                       dd¦  «        \  }}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   s      r   ÚmakeCheckerr/   j   sQ   € ð ˆkÐÐØ)×/Ò/°°QÑ7Ô7Ñˆ�)�)àˆØˆ	Ý˜hÑ'Ô'×7Ò7¸	ÑBÔBÐBr   c                   ó~   — e Zd ZU dZdZeeee                           e	d<   e
j        Zd„ Zd„ Zd„ Zd„ Zd„ Zd	„ Zd
„ ZdS )Ú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                 ó&   — | j         du p|| j         v S )zR
        Returns whether a particular credentials interface is supported.
        N)r2   )ÚselfÚ	interfaces     r   ÚsupportsInterfacez!AuthOptionMixin.supportsInterface”   s   € ð Ô'¨4Ð/ÐX°9ÀÔ@XÐ3XÐXr   c                 óJ   — |j         D ]}|                      |¦  «        r dS ŒdS )z‡
        Returns whether a checker factory will provide at least one of
        the credentials interfaces that we care about.
        TF)r   r6   ©r4   r'   r5   s      r   ÚsupportsCheckerFactoryz&AuthOptionMixin.supportsCheckerFactoryš   s=   € ð
 !Ô5ð 	ð 	ˆIØ×%Ò% iÑ0Ô0ð Ø�t�tðàˆur   c                 ó~  — g }| j         €|j        }n4|j        D ],}|                      |¦  «        r|                     |¦  «         Œ-|st	          |j        ¦  «        ‚d| vri | d<   d| vrg | d<   | d                              |¦  «         |D ]1}| d                              |g ¦  «                             |¦  «         Œ2dS )zM
        Supply a supplied credentials checker to the Options class.
        NÚcredInterfacesÚcredCheckers)r2   r   r6   Úappendr#   Ú
setdefault)r4   ÚcheckerÚ	supportedr5   s       r   Ú
addCheckerzAuthOptionMixin.addChecker¤   s  € ð
 ˆ	ØÔ#Ð+ØÔ4ˆIˆIà$Ô9ð 0ð 0�	Ø×)Ò)¨)Ñ4Ô4ð 0Ø×$Ò$ YÑ/Ô/Ð/øØð 	FÝ'¨Ô(DÑEÔEÐEà 4Ð'Ð'Ø%'ˆDÐ!Ñ"Ø Ð%Ð%Ø#%ˆD�Ñ Øˆ^Ô×#Ò# GÑ,Ô,Ð,Ø"ð 	Mð 	MˆIØÐ!Ô"×-Ò-¨i¸Ñ<Ô<×CÒCÀGÑLÔLÐLÐLð	Mð 	Mr   c                 óZ  — 	 |                       t          |¦  «        ¦  «         dS # t          $ r'}t          j        d|j        d         z  ¦  «        ‚d}~wt          $ r'}t          j        d|j        d         z  ¦  «        ‚d}~wt          $ r}t          j        d|z  ¦  «        ‚d}~ww xY w)zB
        Specify an authentication method for the server.
        zAuth plugin not supported: %sr   NzAuth plugin not recognized: %szUnexpected error: %s)rA   r/   r#   r	   Ú
UsageErrorÚargsr   Ú	Exception)r4   r.   Úes      r   Úopt_authzAuthOptionMixin.opt_auth»   sÉ   € ð	?Ø�OŠO�K¨Ñ4Ô4Ñ5Ô5Ð5Ð5Ð5øÝ$ð 	Pð 	Pð 	PÝÔ"Ð#BÀQÄVÈAÄYÑ#NÑOÔOÐOøøøøÝð 	Qð 	Qð 	QÝÔ"Ð#CÀaÄfÈQÄiÑ#OÑPÔPÐPøøøøÝð 	?ð 	?ð 	?ÝÔ"Ð#9¸AÑ#=Ñ>Ô>Ð>øøøøð	?øøøs,   ‚"& ¦
B*°"AÁB*Á"BÂB*ÂB%Â%B*c              #   óv   K  — t          ¦   «         D ]'}|j        D ]}|                      |¦  «        r|V —  nŒŒ(dS )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%   r   r6   r8   s      r   Ú_checkerFactoriesForOptHelpAuthz/AuthOptionMixin._checkerFactoriesForOptHelpAuthÈ   sc   è è € õ
 ,Ñ-Ô-ð 	ð 	ˆGØ$Ô9ð ð �	Ø×)Ò)¨)Ñ4Ô4ð Ø!�M�M�MØ�Eðøð	ð 	r   c                 óx  — | j                              d¦  «         | j                              d¦  «         | j                              d¦  «         d}|                      ¦   «         D ].}t          |j        ¦  «        |k    rt          |j        ¦  «        }Œ/d|z  }| j                              |dz  ¦  «         | j                              |dz  ¦  «         |                      ¦   «         D ]+}| j                              ||j        |j        fz  ¦  «         Œ,| j                              d¦  «         t          d¦  «        ‚)z<
        Show all authentication methods available.
        z#Usage: --auth AuthType[:ArgString]
z-For detailed help: --help-auth-type AuthType
ú
r   z  %%-%is	%%s
)ÚAuthTypezArgString format)z========z================)Ú
authOutputÚwriterI   Úlenr   r   Ú
SystemExit)r4   ÚfirstLengthr'   ÚformatStrings       r   Úopt_help_authzAuthOptionMixin.opt_help_authÓ   sB  € ð 	Œ×ÒÐDÑEÔEÐEØŒ×ÒÐNÑOÔOÐOØŒ×Ò˜dÑ#Ô#Ð#àˆØ×;Ò;Ñ=Ô=ð 	4ð 	4ˆGÝ�7Ô#Ñ$Ô$ {Ò2Ð2Ý! 'Ô"2Ñ3Ô3�øØ(¨;Ñ6ˆØŒ×Ò˜lÐ-MÑMÑNÔNÐNØŒ×Ò˜lÐ-MÑMÑNÔNÐNØ×;Ò;Ñ=Ô=ð 	ð 	ˆGØŒO×!Ò!Ø Ô 0°'Ô2IÐJÑJñô ð ð ð 	Œ×Ò˜dÑ#Ô#Ð#Ý˜‰mŒmÐr   c                 óÎ  — 	 t          |¦  «        }n%# t          $ r t          j        d|z  ¦  «        ‚w xY w| j                             d|z  ¦  «         | j                             d|j        z  ¦  «         | j                             d¦  «         |j                             ¦   «          	                    ¦   «         D ]1}| j                             d| 
                    ¦   «         z  ¦  «         Œ2| j                             d¦  «         |                      |¦  «        s<| j                             dt          z  ¦  «         | j                             d¦  «         t          d¦  «        ‚)zA
        Show help for a particular authentication type.
        zInvalid auth type: %szUsage: --auth %s[:ArgString]
zArgString format: %s
rK   z  %s
r   )r(   r   r	   rC   rM   rN   r   r   ÚstripÚ
splitlinesÚrstripr9   ÚnotSupportedWarningrP   )r4   r   ÚcfÚlines       r   Úopt_help_auth_typez"AuthOptionMixin.opt_help_auth_typeé   sW  € ð	GÝ# HÑ-Ô-ˆBˆBøÝð 	Gð 	Gð 	GÝÔ"Ð#:¸XÑ#EÑFÔFÐFð	GøøøàŒ×ÒÐ>ÀÑIÑJÔJÐJØŒ×ÒÐ6¸Ô9KÑKÑLÔLÐLØŒ×Ò˜dÑ#Ô#Ð#Ø”K×%Ò%Ñ'Ô'×2Ò2Ñ4Ô4ð 	<ð 	<ˆDØŒO×!Ò! (¨T¯[ª[©]¬]Ñ":Ñ;Ô;Ð;Ð;ØŒ×Ò˜dÑ#Ô#Ð#Ø×*Ò*¨2Ñ.Ô.ð 	(ØŒO×!Ò! (Õ-@Ñ"@ÑAÔAÐAØŒO×!Ò! $Ñ'Ô'Ð'Ý˜‰mŒmÐs   ‚ ’"4)r   r   r   r   r2   r   r   r   r   Ú__annotations__ÚsysÚstdoutrM   r6   r9   rA   rG   rI   rS   r[   r   r   r   r1   r1   x   s¹   € € € € € € ðð ð0 @DÐ˜ (¨4°	¬?Ô";Ô<ÐCÐCÑCØ”€JðYð Yð Yðð ð ðMð Mð Mð.?ð ?ð ?ð	ð 	ð 	ðð ð ð,ð ð ð ð r   r1   )r   r]   Útypingr   r   r   Úzope.interfacer   r   Útwisted.pluginr   Útwisted.pythonr	   r   rE   r   r   r!   r#   rX   r%   r(   r/   r1   r   r   r   ú<module>rc      s¾  ððð ð €
€
€
Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +à /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à %Ð %Ð %Ð %Ð %Ð %Ø  Ð  Ð  Ð  Ð  Ð  ðð ð ð ð �iñ ô ð ð<ð ð ð ð �yñ ô ð ðð ð ð ð Ð&ñ ô ð ðð ð ð ð Ð 0ñ ô ð ðð ð ð ð Ð,ñ ô ð ð XÐ ð'ð 'ð 'ð$ð $ð $ðCð Cð CðBð Bð Bð Bð Bñ Bô Bð Bð Bð Br   