+
    üÐjÍ#  ã                   ó  € ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
 ^ RIHt Rt]! ]	P                  4       ! R R4      4       t ! R	 R
]P                   4      t ! R R]P$                  4      t ! R R]P$                  4      tR# )é    )Úimplementer)Údefer)Úunittest)ÚjidÚsaslÚsasl_mechanismsÚ	xmlstream)Údomishú urn:ietf:params:xml:ns:xmpp-saslc                   óB   a € ] tR t^t o RtRtRtRtR tR t	R t
RtV tR# )	ÚDummySASLMechanisma€  
Dummy SASL mechanism.

This just returns the initialResponse passed on creation, stores any
challenges and replies with the value of C{response}.

@ivar challenge: Last received challenge.
@type challenge: C{unicode}.
@ivar initialResponse: Initial response to be returned when requested
                       via C{getInitialResponse} or L{None}.
@type initialResponse: C{unicode}
NÚDUMMYó    c                ó   € Wn         R # ©N©ÚinitialResponse)Úselfr   s   &&ÚD/usr/lib/python3/dist-packages/twisted/words/test/test_jabbersasl.pyÚ__init__ÚDummySASLMechanism.__init__"   s   € Ø.Ör   c                ó   € V P                   # r   r   ©r   s   &r   ÚgetInitialResponseÚ%DummySASLMechanism.getInitialResponse%   s   € Ø×#Ñ#Ð#r   c                ó&   € Wn         V P                  # r   )Ú	challengeÚresponse)r   r   s   &&r   ÚgetResponseÚDummySASLMechanism.getResponse(   s   € Ø"ŒØ�}‰}Ðr   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Únamer   r   r   r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s/   ø‡ € ñð €IØ€DØ€Hò/ò$÷ð r   r   c                   ó.   a € ] tR t^-t o RtRtR tRtV tR# )ÚDummySASLInitiatingInitializeraG  
Dummy SASL Initializer for initiating entities.

This hardwires the SASL mechanism to L{DummySASLMechanism}, that is
instantiated with the value of C{initialResponse}.

@ivar initialResponse: The initial response to be returned by the
                       dummy SASL mechanism or L{None}.
@type initialResponse: C{unicode}.
Nc                ó:   € \        V P                  4      V n        R # r   )r   r   Ú	mechanismr   s   &r   ÚsetMechanismÚ+DummySASLInitiatingInitializer.setMechanism;   s   € Ü+¨D×,@Ñ,@ÓAˆŽr   )r.   )	r!   r"   r#   r$   r%   r   r/   r'   r(   r)   s   @r   r,   r,   -   s   ø‡ € ñ	ð €O÷Bð Br   r,   c                   óf   a € ] tR t^?t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tRtV tR# )ÚSASLInitiatingInitializerTestsz-
Tests for L{sasl.SASLInitiatingInitializer}
c                óz  € . V n         \        P                  ! 4       V n        \        P                  ! V P                  4      V n        V P                   P
                  V P                  n        V P                  P                  4        V P                  P                  R 4       \        V P                  4      V n
        R# )s�   <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345' version='1.0'>N)Úoutputr	   ÚAuthenticatorÚauthenticatorÚ	XmlStreamÚappendÚsendÚconnectionMadeÚdataReceivedr,   Úinitr   s   &r   ÚsetUpÚ$SASLInitiatingInitializerTests.setUpD   s�   € ØˆŒä&×4Ò4Ó6ˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŒØ"Ÿk™k×0Ñ0ˆ�‰ÔØ�‰×%Ñ%Ô'Ø�‰×#Ñ#ð<ô	
ô
 3°4·>±>ÓBˆŽ	r   c                ó¶  a € \         P                  ! R4      pVP                  R4       \        P                  ! 4       S P
                  n        S P
                  P                  V4       S P                  S P
                  P                  \        P                  4       S P
                  P                  P                  V 3R l4       S P
                  P                  # )z<
Test that the SASL error condition is correctly extracted.
únot-authorizedc                 ó<   <€ SP                  R V P                  4      # )r@   )ÚassertEqualÚ	condition)Úer   s   &€r   Ú<lambda>Ú?SASLInitiatingInitializerTests.test_onFailure.<locals>.<lambda>\   s   ø€ �d×&Ñ&Ð'7¸¿¹ÔEr   )r   Úfailure)r
   ÚElementÚ
addElementr   ÚDeferredr<   Ú	_deferredÚ	onFailureÚassertFailurer   ÚSASLAuthErrorÚaddCallback)r   rG   s   f r   Útest_onFailureÚ-SASLInitiatingInitializerTests.test_onFailureR   s•   ø€ ô —.’.Ð!PÓQˆØ×ÑÐ+Ô,Ü#ŸnšnÓ.ˆ�	‰	ÔØ�	‰	×Ñ˜GÔ$Ø×Ñ˜4Ÿ9™9×.Ñ.´×0BÑ0BÔCØ�	‰	×Ñ×'Ñ'ÜEô	
ð �y‰y×"Ñ"Ð"r   c                ób  € RV P                   n        V P                   P                  4        V P                  ^ ,          pV P	                  \
        VP                  4       V P	                  RVP                  4       V P	                  RVR,          4       V P	                  R\        V4      4       R# )z8
Test starting authentication with an initial response.
s   dummyÚauthr   r.   zZHVtbXk=N)	r<   r   Ústartr4   rB   ÚNS_XMPP_SASLÚurir&   Ústr©r   rS   s   & r   Útest_sendAuthInitialResponseÚ;SASLInitiatingInitializerTests.test_sendAuthInitialResponse`   s|   € ð %-ˆ�	‰	Ô!Ø�	‰	�‰ÔØ�{‰{˜1�~ˆØ×Ñœ t§x¡xÔ0Ø×Ñ˜ §¡Ô+Ø×Ñ˜ $ {Õ"3Ô4Ø×Ñ˜¤S¨£YÖ/r   c                ó¸   € RV P                   n        V P                   P                  4        V P                  ^ ,          pV P	                  R\        V4      4       R# )z;
Test starting authentication without an initial response.
NÚ ©r<   r   rT   r4   rB   rW   rX   s   & r   Útest_sendAuthNoInitialResponseÚ=SASLInitiatingInitializerTests.test_sendAuthNoInitialResponsel   s?   € ð %)ˆ�	‰	Ô!Ø�	‰	�‰ÔØ�{‰{˜1�~ˆØ×Ñ˜œS ›YÖ'r   c                ó¸   € RV P                   n        V P                   P                  4        V P                  ^ ,          pV P	                  R\        V4      4       R# )zC
Test starting authentication where the initial response is empty.
r   Ú=Nr]   rX   s   & r   Ú!test_sendAuthEmptyInitialResponseÚ@SASLInitiatingInitializerTests.test_sendAuthEmptyInitialResponseu   s?   € ð %(ˆ�	‰	Ô!Ø�	‰	�‰ÔØ�{‰{˜1�~ˆØ×Ñ˜œc $›iÖ(r   c                ó`  € V P                   P                  4       p\        P                  ! \        R34      pVP                  R4       V P                   P                  V4       V P                  RV P                   P                  P                  4       V P                   P                  R4       V# )z%
Test receiving a challenge message.
r   ÚbXkgY2hhbGxlbmdls   my challengeN)r<   rT   r
   rH   rU   Ú
addContentÚonChallengerB   r.   r   Ú	onSuccess©r   Údr   s   &  r   Útest_onChallengeÚ/SASLInitiatingInitializerTests.test_onChallenge~   s   € ð �I‰I�O‰OÓˆÜ—N’N¤L°+Ð#>Ó?ˆ	Ø×ÑÐ/Ô0Ø�	‰	×Ñ˜iÔ(Ø×Ñ˜¨$¯)©)×*=Ñ*=×*GÑ*GÔHØ�	‰	×Ñ˜DÔ!Øˆr   c                ó’  € V P                   P                  4       p\        P                  ! \        R34      pVP                  R4       RV P                   P                  n        V P                   P                  V4       V P                  ^,          pV P                  R\        V4      4       V P                   P                  R4       V# )zC
A non-empty response gets encoded and included as character data.
r   re   s   responsezcmVzcG9uc2U=N)r<   rT   r
   rH   rU   rf   r.   r   rg   r4   rB   rW   rh   )r   rj   r   r   s   &   r   Útest_onChallengeResponseÚ7SASLInitiatingInitializerTests.test_onChallengeResponseŠ   s’   € ð �I‰I�O‰OÓˆÜ—N’N¤L°+Ð#>Ó?ˆ	Ø×ÑÐ/Ô0Ø'2ˆ�	‰	×ÑÔ$Ø�	‰	×Ñ˜iÔ(Ø—;‘;˜q•>ˆØ×Ñ˜¬¨X«Ô7Ø�	‰	×Ñ˜DÔ!Øˆr   c                ó>  € V P                   P                  4       p\        P                  ! \        R34      pV P                   P                  V4       V P                  RV P                   P                  P                  4       V P                   P                  R4       V# )z,
Test receiving an empty challenge message.
r   r   N)
r<   rT   r
   rH   rU   rg   rB   r.   r   rh   ri   s   &  r   Útest_onChallengeEmptyÚ4SASLInitiatingInitializerTests.test_onChallengeEmpty˜   sp   € ð �I‰I�O‰OÓˆÜ—N’N¤L°+Ð#>Ó?ˆ	Ø�	‰	×Ñ˜iÔ(Ø×Ñ˜˜dŸi™i×1Ñ1×;Ñ;Ô<Ø�	‰	×Ñ˜DÔ!Øˆr   c                ó
  € V P                   P                  4       p\        P                  ! \        R34      pVP                  R4       V P                   P                  V4       V P                  V\        P                  4       V# )z:
Test receiving a challenge message with illegal padding.
r   zbXkg=Y2hhbGxlbmdl©
r<   rT   r
   rH   rU   rf   rg   rM   r   ÚSASLIncorrectEncodingErrorri   s   &  r   Útest_onChallengeIllegalPaddingÚ=SASLInitiatingInitializerTests.test_onChallengeIllegalPadding£   óc   € ð �I‰I�O‰OÓˆÜ—N’N¤L°+Ð#>Ó?ˆ	Ø×ÑÐ0Ô1Ø�	‰	×Ñ˜iÔ(Ø×Ñ˜1œd×=Ñ=Ô>Øˆr   c                ó
  € V P                   P                  4       p\        P                  ! \        R34      pVP                  R4       V P                   P                  V4       V P                  V\        P                  4       V# )z=
Test receiving a challenge message with illegal characters.
r   zbXkg*Y2hhbGxlbmdlrt   ri   s   &  r   Ú!test_onChallengeIllegalCharactersÚ@SASLInitiatingInitializerTests.test_onChallengeIllegalCharacters®   rx   r   c                ó
  € V P                   P                  4       p\        P                  ! \        R34      pVP                  R4       V P                   P                  V4       V P                  V\        P                  4       V# )z/
Test receiving a malformed challenge message.
r   Úart   ri   s   &  r   Útest_onChallengeMalformedÚ8SASLInitiatingInitializerTests.test_onChallengeMalformed¹   sb   € ð �I‰I�O‰OÓˆÜ—N’N¤L°+Ð#>Ó?ˆ	Ø×Ñ˜SÔ!Ø�	‰	×Ñ˜iÔ(Ø×Ñ˜1œd×=Ñ=Ô>Øˆr   ©r6   r<   r4   r	   N)r!   r"   r#   r$   r%   r=   rP   rY   r^   rb   rk   rn   rq   rv   rz   r~   r'   r(   r)   s   @r   r2   r2   ?   sG   ø‡ € ñòCò#ò
0ò(ò)ò
òò	ò	ò	÷	ð 	r   r2   c                   óN   a € ] tR t^Åt o RtR tR tR tR tR t	R t
R tR	tV tR
# )Ú*SASLInitiatingInitializerSetMechanismTestsz:
Test for L{sasl.SASLInitiatingInitializer.setMechanism}.
c                ó�  € . V n         \        P                  ! 4       V n        \        P                  ! V P                  4      V n        V P                   P
                  V P                  n        V P                  P                  4        V P                  P                  R 4       \        P                  ! V P                  4      V n        R# )z�<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345' version='1.0'>N)r4   r	   r5   r6   r7   r8   r9   r:   r;   r   ÚSASLInitiatingInitializerr<   r   s   &r   r=   Ú0SASLInitiatingInitializerSetMechanismTests.setUpÊ   s‡   € ØˆŒä&×4Ò4Ó6ˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŒØ"Ÿk™k×0Ñ0ˆ�‰ÔØ�‰×%Ñ%Ô'Ø�‰×#Ñ#ð;ô	
ô ×2Ò2°4·>±>ÓBˆŽ	r   c                ó0  € \         P                  ! \        R34      pVP                  RVR7       W P                  P
                  VP                  VP                  3&   V P                  P                  4        V P                  P                  P                  # )zH
Set up the XML Stream to have a SASL feature with the given mechanism.
Ú
mechanismsr.   )Úcontent)r
   rH   rU   rI   r	   ÚfeaturesrV   r&   r<   r/   r.   )r   r&   Úfeatures   && r   Ú_setMechanismÚ8SASLInitiatingInitializerSetMechanismTests._setMechanismÙ   so   € ô —.’.¤,°Ð!=Ó>ˆØ×Ñ˜;°ÐÔ5Ø?F�‰×Ñ §¡¨g¯l©lÐ ;Ñ<à�	‰	×ÑÔ Ø�y‰y×"Ñ"×'Ñ'Ð'r   c                ó¶   € \         P                  ! R4      V P                  n         RV P                  n        RpV P	                  WP                  V4      4       R# )z9
Test setting ANONYMOUS as the authentication mechanism.
úexample.comNÚ	ANONYMOUS©r   ÚJIDr6   ÚpasswordrB   r‹   ©r   r&   s   & r   Útest_anonymousÚ9SASLInitiatingInitializerSetMechanismTests.test_anonymousä   sG   € ô "%§¢¨Ó!7ˆ×ÑÔØ&*ˆ×ÑÔ#Øˆà×Ñ˜×1Ñ1°$Ó7Ö8r   c                ó¶   € \         P                  ! R4      V P                  n         RV P                  n        RpV P	                  WP                  V4      4       R# )z5
Test setting PLAIN as the authentication mechanism.
útest@example.comÚsecretÚPLAINNr�   r“   s   & r   Ú
test_plainÚ5SASLInitiatingInitializerSetMechanismTests.test_plainî   sH   € ô "%§¢Ð);Ó!<ˆ×ÑÔØ&.ˆ×ÑÔ#Øˆà×Ñ˜×1Ñ1°$Ó7Ö8r   c                ó¶   € \         P                  ! R4      V P                  n         RV P                  n        RpV P	                  WP                  V4      4       R# )z:
Test setting DIGEST-MD5 as the authentication mechanism.
r—   r˜   z
DIGEST-MD5Nr�   r“   s   & r   Útest_digestÚ6SASLInitiatingInitializerSetMechanismTests.test_digestø   sH   € ô "%§¢Ð);Ó!<ˆ×ÑÔØ&.ˆ×ÑÔ#Øˆà×Ñ˜×1Ñ1°$Ó7Ö8r   c                óÈ   € \         P                  ! R4      V P                  n         RV P                  n        V P	                  \
        P                  V P                  R4       R# )z;
Test using an unacceptable SASL authentication mechanism.
r—   r˜   ÚSOMETHING_UNACCEPTABLEN©r   r‘   r6   r’   ÚassertRaisesr   ÚSASLNoAcceptableMechanismr‹   r   s   &r   Útest_notAcceptableÚ=SASLInitiatingInitializerSetMechanismTests.test_notAcceptable  sL   € ô
 "%§¢Ð);Ó!<ˆ×ÑÔØ&.ˆ×ÑÔ#à×ÑÜ×*Ñ*¨D×,>Ñ,>Ð@Xö	
r   c                óÈ   € \         P                  ! R4      V P                  n         RV P                  n        V P	                  \
        P                  V P                  R4       R# )zG
Test using an unacceptable SASL authentication mechanism with no JID.
rŽ   r˜   r    Nr¡   r   s   &r   Útest_notAcceptableWithoutUserÚHSASLInitiatingInitializerSetMechanismTests.test_notAcceptableWithoutUser  sK   € ô "%§¢¨Ó!7ˆ×ÑÔØ&.ˆ×ÑÔ#à×ÑÜ×*Ñ*¨D×,>Ñ,>Ð@Xö	
r   r€   N)r!   r"   r#   r$   r%   r=   r‹   r”   rš   r�   r¤   r§   r'   r(   r)   s   @r   r‚   r‚   Å   s3   ø‡ € ñòCò	(ò9ò9ò9ò

÷	
ð 	
r   r‚   N)Úzope.interfacer   Útwisted.internetr   Útwisted.trialr   Útwisted.words.protocols.jabberr   r   r   r	   Útwisted.words.xishr
   rU   ÚISASLMechanismr   r„   r,   ÚTestCaser2   r‚   © r   r   Ú<module>r±      s   ðõ
 'å "Ý "ß PÓ PÝ %à1€ñ ˆ_×+Ñ+Ó,÷ð ó -ðô:B T×%CÑ%Cô Bô$C X×%6Ñ%6ô CôLR
°×1BÑ1Bö R
r   