o
    jH                     @   sX   d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	 d dlm
Z
 G dd deZdS )	    )List)UniCredential)asyauthSecretasyauthProtocolasyauthSubProtocol)SubProtocol)SubProtocolNativec                   @   s2   e Zd Zg e fdee defddZdd ZdS )SPNEGOCredentialcredentialssubprotocolc                 C   s   t j| tj|d || _d S )N)protocolr   )r   __init__r   SPNEGOr
   )selfr
   r    r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/asyauth/common/credentials/spnego.pyr      s   
zSPNEGOCredential.__init__c                 O   s   | j jtjkrjddlm} t| jdkr#t| jd |r#| jd 	 S || }| jD ]=}|j
di |}|jtjkrG|
tj}|d| q*|jtjkrT|d| q*|jtjkra|d| q*td|j |S td| j  )	Nr   )SPNEGOClientNative   z2NTLMSSP - Microsoft NTLM Security Support ProviderzMS KRB5 - Microsoft Kerberos 5z8Authentication protocol "%s" is not supported for SPNEGOzUnsupported subprotocol "%s"r   )r   typer   NATIVE&asyauth.protocols.spnego.client.nativer   lenr
   
isinstanceget_copybuild_contextr   r   PLAINNTLMadd_auth_contextKERBEROS	Exception)r   argskwargsr   sspi_ctx
credentialcontextr   r   r   r      s"   
zSPNEGOCredential.build_contextN)	__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r   r	      s    r	   N)typingr   asyauth.common.credentialsr   asyauth.common.constantsr   r   r   asyauth.common.subprotocolsr   r   r	   r   r   r   r   <module>   s    