ó
    &ÝNjã,  ã                   ó  • S r SSKJr  SSKJr  SSKJr  SSKJr   " S S5      r	 " S	 S
\	5      r
 " S S\	5      r " S S\	5      r " S S\5      r " S S\5      r\" SSS/5      r " S S\5      r " S S\5      r " S S5      rg)z¿
Modern, adaptable authentication machinery.

Replaces certain parts of `.SSHClient`. For a concrete implementation, see the
``OpenSSHAuthStrategy`` class in `Fabric <https://fabfile.org>`_.
é    )Ú
namedtupleé   )ÚAgentKey)ÚAuthenticationException)Ú
get_loggerc                   ó0   • \ rS rSrSrS rS rS rS rSr	g)	Ú
AuthSourceé   zÓ
Some SSH authentication source, such as a password, private key, or agent.

See subclasses in this module for concrete implementations.

All implementations must accept at least a ``username`` (``str``) kwarg.
c                 ó   • Xl         g ©N©Úusername)Úselfr   s     ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/paramiko/auth_strategy.pyÚ__init__ÚAuthSource.__init__   s   € Ø �ó    c                 ó¼   • UR                  5        VVs/ s H  u  p#U SU< 3PM     nnnSR                  U5      nU R                  R                   SU S3$ s  snnf )NÚ=z, Ú(Ú))ÚitemsÚjoinÚ	__class__Ú__name__)r   ÚkwargsÚkÚvÚpairsÚjoineds         r   Ú_reprÚAuthSource._repr   s[   € ð +1¯,©,¬.Ô9ª.¡$ !�A�3�a˜‘u“©.ˆÑ9Ø—‘˜5Ó!ˆØ—.‘.×)Ñ)Ð*¨!¨F¨8°1Ð5Ð5ùó :s   ”Ac                 ó"   • U R                  5       $ r   )r!   ©r   s    r   Ú__repr__ÚAuthSource.__repr__"   s   € Ø�z‰z‹|Ðr   c                 ó   • [         e)z
Perform authentication.
©ÚNotImplementedError©r   Ú	transports     r   ÚauthenticateÚAuthSource.authenticate%   s
   € ô "Ð!r   r   N)
r   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r!   r%   r,   Ú__static_attributes__© r   r   r	   r	      s   † ñò!ò6òõ"r   r	   c                   ó   • \ rS rSrSrS rSrg)ÚNoneAuthé,   zK
Auth type "none", ie https://www.rfc-editor.org/rfc/rfc4252#section-5.2 .
c                 ó8   • UR                  U R                  5      $ r   )Ú	auth_noner   r*   s     r   r,   ÚNoneAuth.authenticate1   s   € Ø×"Ñ" 4§=¡=Ó1Ð1r   r3   N©r   r.   r/   r0   r1   r,   r2   r3   r   r   r5   r5   ,   s   † ñõ2r   r5   c                   ó>   ^ • \ rS rSrSrU 4S jrU 4S jrS rSrU =r	$ )ÚPasswordé5   aó  
Password authentication.

:param callable password_getter:
    A lazy callable that should return a `str` password value at
    authentication time, such as a `functools.partial` wrapping
    `getpass.getpass`, an API call to a secrets store, or similar.

    If you already know the password at instantiation time, you should
    simply use something like ``lambda: "my literal"`` (for a literal, but
    also, shame on you!) or ``lambda: variable_name`` (for something stored
    in a variable).
c                 ó,   >• [         TU ]  US9  X l        g ©Nr   )Úsuperr   Úpassword_getter)r   r   rA   r   s      €r   r   ÚPassword.__init__D   s   ø€ Ü‰Ñ (ÐÑ+Ø.Õr   c                 ó2   >• [         TU ]  U R                  S9$ )N)Úuser)r@   r!   r   )r   r   s    €r   r%   ÚPassword.__repr__H   s   ø€ ô ‰w‰} $§-¡-ˆ}Ð0Ð0r   c                 óZ   • U R                  5       nUR                  U R                  U5      $ r   )rA   Úauth_passwordr   )r   r+   Úpasswords      r   r,   ÚPassword.authenticateM   s)   € ð ×'Ñ'Ó)ˆØ×&Ñ& t§}¡}°hÓ?Ð?r   )rA   )
r   r.   r/   r0   r1   r   r%   r,   r2   Ú__classcell__©r   s   @r   r<   r<   5   s   ø† ñõ/õ1÷
@ð @r   r<   c                   ó   • \ rS rSrSrS rSrg)Ú
PrivateKeyéY   ak  
Essentially a mixin for private keys.

Knows how to auth, but leaves key material discovery/loading/decryption to
subclasses.

Subclasses **must** ensure that they've set ``self.pkey`` to a decrypted
`.PKey` instance before calling ``super().authenticate``; typically
either in their ``__init__``, or in an overridden ``authenticate`` prior to
its `super` call.
c                 óN   • UR                  U R                  U R                  5      $ r   )Úauth_publickeyr   Úpkeyr*   s     r   r,   ÚPrivateKey.authenticatef   s   € Ø×'Ñ'¨¯©°t·y±yÓAÐAr   r3   Nr:   r3   r   r   rM   rM   Y   s   † ñ
õBr   rM   c                   ó8   ^ • \ rS rSrSrU 4S jrU 4S jrSrU =r$ )ÚInMemoryPrivateKeyéj   z)
An in-memory, decrypted `.PKey` object.
c                 ó,   >• [         TU ]  US9  X l        g r?   )r@   r   rQ   )r   r   rQ   r   s      €r   r   ÚInMemoryPrivateKey.__init__o   s   ø€ Ü‰Ñ (ÐÑ+à�	r   c                 ó~   >• [         TU ]  U R                  S9n[        U R                  [        5      (       a  US-  nU$ )N©rQ   z [agent])r@   r!   rQ   Ú
isinstancer   )r   Úrepr   s     €r   r%   ÚInMemoryPrivateKey.__repr__t   s9   ø€ ô ‰g‰m §¡ˆmÐ+ˆÜ�d—i‘i¤×*Ñ*Ø�:ÑˆCØˆ
r   rY   ©	r   r.   r/   r0   r1   r   r%   r2   rJ   rK   s   @r   rT   rT   j   s   ø† ñõ÷
ó r   rT   c                   ó2   ^ • \ rS rSrSrU 4S jrS rSrU =r$ )ÚOnDiskPrivateKeyé}   au  
Some on-disk private key that needs opening and possibly decrypting.

:param str source:
    String tracking where this key's path was specified; should be one of
    ``"ssh-config"``, ``"python-config"``, or ``"implicit-home"``.
:param Path path:
    The filesystem path this key was loaded from.
:param PKey pkey:
    The `PKey` object this auth source uses/represents.
c                 óp   >• [         TU ]  US9  X l        SnX%;  a  [        SU< 35      eX0l        X@l        g )Nr   )z
ssh-configzpython-configzimplicit-homez source argument must be one of: )r@   r   ÚsourceÚ
ValueErrorÚpathrQ   )r   r   rb   rd   rQ   Úallowedr   s         €r   r   ÚOnDiskPrivateKey.__init__Š   s@   ø€ Ü‰Ñ (ÐÑ+ØŒØBˆØÓ ÜÐ?À¹{ÐKÓLÐLØŒ	à�	r   c                 ór   • U R                  U R                  U R                  [        U R                  5      S9$ )N)Úkeyrb   rd   )r!   rQ   rb   Ústrrd   r$   s    r   r%   ÚOnDiskPrivateKey.__repr__”   s/   € Ø�z‰zØ—	‘	 $§+¡+´C¸¿	¹	³Nð ð 
ð 	
r   )rd   rQ   rb   r]   rK   s   @r   r_   r_   }   s   ø† ñ
õ÷
ð 
r   r_   ÚSourceResultrb   Úresultc                   ó2   ^ • \ rS rSrSrU 4S jrS rSrU =r$ )Ú
AuthResultéª   a†  
Represents a partial or complete SSH authentication attempt.

This class conceptually extends `AuthStrategy` by pairing the former's
authentication **sources** with the **results** of trying to authenticate
with them.

`AuthResult` is a (subclass of) `list` of `namedtuple`, which are of the
form ``namedtuple('SourceResult', 'source', 'result')`` (where the
``source`` member is an `AuthSource` and the ``result`` member is either a
return value from the relevant `.Transport` method, or an exception
object).

.. note::
    Transport auth method results are always themselves a ``list`` of "next
    allowable authentication methods".

    In the simple case of "you just authenticated successfully", it's an
    empty list; if your auth was rejected but you're allowed to try again,
    it will be a list of string method names like ``pubkey`` or
    ``password``.

    The ``__str__`` of this class represents the empty-list scenario as the
    word ``success``, which should make reading the result of an
    authentication session more obvious to humans.

Instances also have a `strategy` attribute referencing the `AuthStrategy`
which was attempted.
c                 ó2   >• Xl         [        TU ]  " U0 UD6  g r   )Ústrategyr@   r   )r   rq   Úargsr   r   s       €r   r   ÚAuthResult.__init__É   s   ø€ Ø ŒÜ‰Ò˜$Ð) &Ó)r   c                 ó2   • SR                  S U  5       5      $ )NÚ
c              3   óh   #   • U  H(  oR                    S UR                  =(       d    S 3v •  M*     g7f)z -> ÚsuccessN)rb   rl   )Ú.0Úxs     r   Ú	<genexpr>Ú%AuthResult.__str__.<locals>.<genexpr>Ò   s*   é € ð 
Ú>B¸�x‰xˆj˜˜QŸX™X×2¨Ð3Õ4ºdùs   ‚02)r   r$   s    r   Ú__str__ÚAuthResult.__str__Í   s"   € ð
 �y‰yñ 
Ù>Bó
ó 
ð 	
r   ©rq   )	r   r.   r/   r0   r1   r   r|   r2   rJ   rK   s   @r   rn   rn   ª   s   ø† ñõ<*÷
ð 
r   rn   c                   ó$   • \ rS rSrSrS rS rSrg)ÚAuthFailureéØ   a’  
Basic exception wrapping an `AuthResult` indicating overall auth failure.

Note that `AuthFailure` descends from `AuthenticationException` but is
generally "higher level"; the latter is now only raised by individual
`AuthSource` attempts and should typically only be seen by users when
encapsulated in this class. It subclasses `AuthenticationException`
primarily for backwards compatibility reasons.
c                 ó   • Xl         g r   ©rl   )r   rl   s     r   r   ÚAuthFailure.__init__ã   s   € Ø�r   c                 ó2   • S[        U R                  5      -   $ )Nru   )ri   rl   r$   s    r   r|   ÚAuthFailure.__str__æ   s   € Ø”c˜$Ÿ+™+Ó&Ñ&Ð&r   rƒ   N)r   r.   r/   r0   r1   r   r|   r2   r3   r   r   r€   r€   Ø   s   † ñòõ'r   r€   c                   ó*   • \ rS rSrSrS rS rS rSrg)ÚAuthStrategyéê   zì
This class represents one or more attempts to auth with an SSH server.

By default, subclasses must at least accept an ``ssh_config``
(`.SSHConfig`) keyword argument, but may opt to accept more as needed for
their particular strategy.
c                 ó8   • Xl         [        [        5      U l        g r   )Ú
ssh_configr   r   Úlog)r   r‹   s     r   r   ÚAuthStrategy.__init__ó   s   € ð %ŒÜœhÓ'ˆ�r   c                 ó   • [         e)a+  
Generator yielding `AuthSource` instances, in the order to try.

This is the primary override point for subclasses: you figure out what
sources you need, and ``yield`` them.

Subclasses _of_ subclasses may find themselves wanting to do things
like filtering or discarding around a call to `super`.
r(   r$   s    r   Úget_sourcesÚAuthStrategy.get_sourcesú   s
   € ô "Ð!r   c                 ó´  • Sn[        U S9nU R                  5        HX  nU R                  R                  SU 35         UR	                  U5      nSnUR                  [        XE5      5        U(       d  MX    O   U(       d	  [        US9eU$ ! [
         aC  nUnUR                  R                  nU R                  R                  SU SU 35         SnAN�SnAff = f)	z›
Handles attempting `AuthSource` instances yielded from `get_sources`.

You *normally* won't need to override this, but it's an option for
advanced users.
Fr~   zTrying TzAuthentication via z failed with Nrƒ   )rn   r�   rŒ   Údebugr,   Ú	Exceptionr   r   ÚinfoÚappendrk   r€   )r   r+   Ú	succeededÚoverall_resultrb   rl   ÚeÚsource_classs           r   r,   ÚAuthStrategy.authenticate  sÙ   € ð ˆ	Ü#¨TÑ2ˆð ×&Ñ&Ö(ˆFØ�H‰H�N‰N˜W V HÐ-Ô.ðØ×,Ñ,¨YÓ7�Ø �	ð" ×!Ñ!¤,¨vÓ">Ô?ßˆyÙñ/ )ö4 Ü ^Ñ4Ð4àÐøô) ó Ø�ð  !Ÿ{™{×3Ñ3�Ø—‘—‘Ø)¨&¨°¸|¸nÐM÷ñ ûðús   ¾B
Â

CÂ9CÃC)rŒ   r‹   N)	r   r.   r/   r0   r1   r   r�   r,   r2   r3   r   r   rˆ   rˆ   ê   s   † ñò(ò
"õ+r   rˆ   N)r1   Úcollectionsr   Úagentr   Ússh_exceptionr   Úutilr   r	   r5   r<   rM   rT   r_   rk   Úlistrn   r€   rˆ   r3   r   r   Ú<module>r       s�   ðñõ #å Ý 2Ý ÷"ñ "ô:2ˆzô 2ô@ˆzô @ôHB�ô Bô"˜ô ô&
�zô 
ñB ˜.¨8°XÐ*>Ó?€ô*
�ô *
ô\'Ð)ô '÷$Gò Gr   