#NEWLINE# def _try_auth( self ) : #NEWLINE# #INDENT# 'Try to authenticate using the first one of allowed authentication\n        methods left.\n\n        [client only]' #NEWLINE# if self . authenticated : #NEWLINE# #INDENT# self . __logger . debug ( 'try_auth: already authenticated' ) #NEWLINE# return #NEWLINE# #UNINDENT# self . __logger . debug ( ( 'trying auth: %r' % ( self . _auth_methods_left , ) ) ) #NEWLINE# if ( not self . _auth_methods_left ) : #NEWLINE# #INDENT# raise LegacyAuthenticationError ( 'No allowed authentication methods available' ) #NEWLINE# #UNINDENT# method = self . _auth_methods_left [ 0 ] #NEWLINE# if method . startswith ( 'sasl:' ) : #NEWLINE# #INDENT# return ClientStream . _try_auth ( self ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( method not in ( 'plain' , 'digest' ) ) : #NEWLINE# #INDENT# self . _auth_methods_left . pop ( 0 ) #NEWLINE# self . __logger . debug ( ( 'Skipping unknown auth method: %s' % method ) ) #NEWLINE# return self . _try_auth ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . available_auth_methods is not None ) : #NEWLINE# #INDENT# if ( method in self . available_auth_methods ) : #NEWLINE# #INDENT# self . _auth_methods_left . pop ( 0 ) #NEWLINE# self . auth_method_used = method #NEWLINE# if ( method == 'digest' ) : #NEWLINE# #INDENT# self . _digest_auth_stage2 ( self . auth_stanza ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _plain_auth_stage2 ( self . auth_stanza ) #NEWLINE# #UNINDENT# self . auth_stanza = None #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . __logger . debug ( ( 'Skipping unavailable auth method: %s' % method ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . _auth_stage1 ( )