
    i(              
          S r SSKrSSKrSSKJr  SSKJrJr  \R                   " S S5      5       r	\R                   " S S5      5       r
\R                   " S	 S
5      5       r\R                   " S S5      5       r\R                   " S S5      5       r\R                  \
\\\\	4   r   SS\R                   \R                  \\\R$                  \   4      S\R                   \   S\R                   \   S\R$                  \   4S jjrg)zCredentials that can be used by a client.

These are the various credentials that can be used as a client to authenticate
with a service. See the docstring for each credential type to identify what
credentials are usable for each authenticaton protocol.
    N)is_ntlm_hash)InvalidCredentialErrorNoCredentialErrorc                       \ rS rSr% Sr\\S'   \R                  " SS9r	\\S'   \
S\R                  \   4S j5       rS	rg
)Password   zPlaintext username and password credential.

This is the simple username and password credential that is supported by
all authentication protocols.

Attributes:
    username: The username.
    password: The password for the user.
usernameF)reprpasswordreturnc                 
    / SQ$ )1List of protocols the credential can be used for.)credsspkerberosntlm selfs    L/home/james-whalen/.local/lib/python3.13/site-packages/spnego/_credential.pysupported_protocolsPassword.supported_protocols#   s
     /.    r   N)__name__
__module____qualname____firstlineno____doc__str__annotations__dataclassesfieldr   propertytypingListr   __static_attributes__r   r   r   r   r      sE     M%%51Hc1/V[[%5 / /r   r   c                   t    \ rS rSr% SrSr\R                  \   \	S'   \
S\R                  \   4S j5       rSrg)CredentialCache)   zCached credential.

Uses the provider specific cached credential. Can also specify a username
to select a specific cached credential.

Attributes:
    username: Optional username used to select a specific credential in the
        cache.
Nr	   r   c                 
    SS/$ )Nr   r   r   r   s    r   r   #CredentialCache.supported_protocols7   s    F##r   r   )r   r   r   r   r   r	   r#   Optionalr   r   r"   r$   r   r%   r   r   r   r'   r'   )   s>     &*Hfooc")$V[[%5 $ $r   r'   c                       \ rS rSr% Sr\\S'   \R                  " SSS9r	\
R                  \   \S'   \R                  " SSS9r\
R                  \   \S'   \S	\
R                  \   4S
 j5       rSrg)NTLMHash<   a  NTLM LM/NT Hash credential.

Used with :class:`NTLMProxy` for NTLM authentication backed by an NT and/or
LM hash value. In modern iterations of NTLM only the NT hash needs to be
specified and LM is ignored but both can be specified and the NTLM code
will use them as necessary.

Attributes:
    username: The username the hashes are for.
    lm_hash: The LM hash as a hex string, can be `None` in most cases.
    nt_hash: The NT hash as a hex string.
r	   NF)defaultr
   lm_hashnt_hashr   c                     S/$ )r   r   r   r   s    r   r   NTLMHash.supported_protocolsO   s     xr   r   )r   r   r   r   r   r   r   r    r!   r0   r#   r+   r1   r"   r$   r   r%   r   r   r   r-   r-   <   sp     M$/$5$5d$OGV__S!O$/$5$5d$OGV__S!OV[[%5  r   r-   c                   ~    \ rS rSr% Sr\\S'   Sr\R                  \   \S'   \
S\R                  \   4S j5       rSrg)	KerberosKeytabU   a9  Kerberos Keytab Credential.

Used with :class:`GSSAPIProxy` or :class:`SSPIProxy` for Kerberos
authentication. It is used to retrieve a Kerberos ticket using a keytab for
authentication rather than a password.

Attributes:
    keytab: The keytab to use for authentication. The path will not be
        expanded of have variables substituted so should be the absolute
        path to the keytab.
    principal: The Kerberos principal to get the credential for. Should be
        in the UPN form `username@REALM.COM`. Set to `None` to use the
        first keytab entry.
keytabN	principalr   c                     S/$ r   r   r   r   s    r   r   "KerberosKeytab.supported_protocolsi        |r   r   r   r   r   r   r   r   r   r8   r#   r+   r"   r$   r   r%   r   r   r   r5   r5   U   sC     K&*Ivs#*V[[%5  r   r5   c                   ~    \ rS rSr% Sr\\S'   Sr\R                  \   \S'   \
S\R                  \   4S j5       rSrg)	KerberosCCacheo   a  Kerberos CCache Credential.

Used with :class:`GSSAPIProxy` for Kerberos authentication. It is used to
specify the credential cache that has the stored Kerberos credential for
authentication. The ccache value is specified in the form ``TYPE:RESIDUAL``
where the ``TYPE`` supported is down to the installed Kerberos/GSSAPI
implementation and ``RESIDUAL`` is a value specific to the type. Common
types are:

    DIR: The value is the path to a directory containing a collection of
        `FILE` caches.
    FILE: The value is the path to an individual cache.
    MEMORY: The value is a unique identifier to a cache stored in memory of
        the current process. It must be resolvable by the linked GSSAPI
        provider that this library uses.

There are other ccache types but they are mostly platform or GSSAPI
implementation specific.

.. Note:
    This only works on Linux, Windows does not have the concept of
    separate CCaches.

Attributes:
    ccache: The ccache in the form ``TYPE:RESIDUAL`` to use for a Kerberos
        credential. The path will not be expanded of have variables
        substituted so should be the absolute path to the ccache.
    principal: Optional principal to get in the credential cache specified.
ccacheNr8   r   c                     S/$ r:   r   r   s    r   r   "KerberosCCache.supported_protocols   r<   r   r   r=   r   r   r   r?   r?   o   sC    < K&*Ivs#*V[[%5  r   r?   r	   r   required_protocolr   c           	         U (       aw  [        U [        5      (       aI  Uc  [        U S9/n O_[        U5      (       a   UR	                  SS5      u  p4[        XUS9/n O/[        XS9/n O$[        U [        5      (       d  U /n O[        5       /n / n[        5       nU  H  n[        U[        [        [        [
        [        45      (       d	  [        SS9eSnUR                   H  n	X;  d  M
  UR                  U	5        S	nM     U(       d  Mn  UR                  U5        M     U(       a.  X&;  a)  S
R                  [!        U5      5      n
[#        SU SU
 3S9eU$ )a  Process user input credentials.

Converts the user facing credential input into a list of credentials that
is known by spnego. Also filters out any duplicate credentials/ones that
are rendered obsolete by any ones preceding it. For example NTLMHash won't
be used if it's specified after Password in the credential list.

Args:
    username: The username or list of credentials to process.
    password: The password for username when it's a string.
    required_protocol: Optionally checks that at least 1 credential must
        support the protocol specified.

Returns:
    typing.List[Credential]: A list of credentials based on the free-form
    input.
)r	   :   )r	   r0   r1   )r	   r   zMInvalid username/credential specified, must be a string or Credential object.)context_msgFTz, zA credential for z* is needed but only found credentials for )
isinstancer   r'   r   splitr-   r   listsetr?   r5   r   r   addappendjoinsortedr   )r	   r   rD   lmntcredentialsused_protocolscredcred_usefulcred_protocolfound_protocolss              r   unify_credentialsrY      sS   , h$$+X>?h''!Q/$hBOP$hJKHd++ zH $%&+-K&)eN$..RZ\d eff(k  !55M2""=1" 6
 ;t$ " .D))F>$:;+,=+> ?./1
 	

 r   )NNN)r   r    r#   spnego._ntlm_raw.cryptor   spnego.exceptionsr   r   	dataclassr   r'   r-   r5   r?   Union
Credentialr+   r   r$   rY   r   r   r   <module>r_      sH     0 G
 / / /( $ $ $$   0   2 % % %X \\/>>8U]]^
 Y]%).2@oofll3
FKK
<S+STU@ooc"@ s+@ [[	@r   