Logo Search packages:      
Sourcecode: paramiko version File versions  Download package

def paramiko::transport::Transport::auth_interactive (   self,
  username,
  handler,
  submethods = '' 
)

Authenticate to the server interactively.  A handler is used to answer
arbitrary questions from the server.  On many servers, this is just a
dumb wrapper around PAM.

This method will block until the authentication succeeds or fails,
peroidically calling the handler asynchronously to get answers to
authentication questions.  The handler may be called more than once
if the server continues to ask questions.

The handler is expected to be a callable that will handle calls of the
form: C{handler(title, instructions, prompt_list)}.  The C{title} is
meant to be a dialog-window title, and the C{instructions} are user
instructions (both are strings).  C{prompt_list} will be a list of
prompts, each prompt being a tuple of C{(str, bool)}.  The string is
the prompt and the boolean indicates whether the user text should be
echoed.

A sample call would thus be:
C{handler('title', 'instructions', [('Password:', False)])}.

The handler should return a list or tuple of answers to the server's
questions.

If the server requires multi-step authentication (which is very rare),
this method will return a list of auth types permissible for the next
step.  Otherwise, in the normal case, an empty list is returned.

@param username: the username to authenticate as
@type username: string
@param handler: a handler for responding to server questions
@type handler: callable
@param submethods: a string list of desired submethods (optional)
@type submethods: str
@return: list of auth types permissible for the next stage of
    authentication (normally empty).
@rtype: list

@raise BadAuthenticationType: if public-key authentication isn't
    allowed by the server for this user
@raise SSHException: if the authentication failed

@since: 1.5

Definition at line 1062 of file transport.py.

01062                                                                 :
        """
        Authenticate to the server interactively.  A handler is used to answer
        arbitrary questions from the server.  On many servers, this is just a
        dumb wrapper around PAM.
        
        This method will block until the authentication succeeds or fails,
        peroidically calling the handler asynchronously to get answers to
        authentication questions.  The handler may be called more than once
        if the server continues to ask questions.
        
        The handler is expected to be a callable that will handle calls of the
        form: C{handler(title, instructions, prompt_list)}.  The C{title} is
        meant to be a dialog-window title, and the C{instructions} are user
        instructions (both are strings).  C{prompt_list} will be a list of
        prompts, each prompt being a tuple of C{(str, bool)}.  The string is
        the prompt and the boolean indicates whether the user text should be
        echoed.
        
        A sample call would thus be:
        C{handler('title', 'instructions', [('Password:', False)])}.
        
        The handler should return a list or tuple of answers to the server's
        questions.
        
        If the server requires multi-step authentication (which is very rare),
        this method will return a list of auth types permissible for the next
        step.  Otherwise, in the normal case, an empty list is returned.

        @param username: the username to authenticate as
        @type username: string
        @param handler: a handler for responding to server questions
        @type handler: callable
        @param submethods: a string list of desired submethods (optional)
        @type submethods: str
        @return: list of auth types permissible for the next stage of
            authentication (normally empty).
        @rtype: list
        
        @raise BadAuthenticationType: if public-key authentication isn't
            allowed by the server for this user
        @raise SSHException: if the authentication failed
        
        @since: 1.5
        """
        if (not self.active) or (not self.initial_kex_done):
            # we should never try to authenticate unless we're on a secure link
            raise SSHException('No existing session')
        my_event = threading.Event()
        self.auth_handler = AuthHandler(self)
        self.auth_handler.auth_interactive(username, handler, my_event, submethods)
        return self.auth_handler.wait_for_response(my_event)

    def set_log_channel(self, name):


Generated by  Doxygen 1.6.0   Back to index