4Suite API Documentation

Module Ft.Server.Common.ClAuthenticate

Repository client (4ss, 4ss_manager) common login routines
Copyright 2004 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:

Classes

class Error

Members

INTERNAL_ERROR = 1
PASSWDFILE_UNDEFINED = 10
class FtServerAuthenticationException(Ft.Server.FtServerBaseException)

Methods inherited from class Ft.Server.FtServerBaseException

Methods inherited from class Ft.FtException

__getattr__, __repr__, __str__

Methods inherited from class Exception

__getitem__

Members

MessageSource = <module 'Ft.Server.Common.MessageSource' from 'b...inux-i686-2.3/Ft/Server/Common/MessageSource.py'>
class PasswordFileManager
A collection of functions to make reading and writing from 4Suite Repository password files more convenient.
A password file maps a username to a password hash, hostname,
and port. The location of the file is determined by the
FTSS_PASSWORD_FILE environment variable. If not set, then the
location is determined from the following:
  - $HOME/.4Suite/<basename>_pass (POSIX systems)
  - %APPDATA%\4Suite\<basename>_pass.conf (Windows 2K/XP/2K3)
  - %USERPROFILE%\4Suite\<basename>_pass.conf (Windows NT)
  - %WINDIR%\4Suite\<basename>_pass.conf (Windows 9x)
If none of the variables are set, an exception is raised.
If the password file does not exist, it will be created when the
first entry is stored. The location must be writable, of course.

Methods

__init__(self)
getFilename(self)
readEntries(self)
writeEntries(self, entries)

Members

envName = None
fileBaseName = None

Functions

GetHostName(prompt='Host: ')
Prompts for a hostname on stderr.
GetPass(prompt='Password: ')
Wrapper for getpass.getpass(), with the only difference being that on Unix, the prompt will be sent to stderr rather than stdout.
GetPort(prompt='Port: ')
Prompts for a port on stderr.
GetUserName(prompt='Username: ', emptyOK=True)
Prompts for a username on stderr. Keeps prompting if emptyOK is false and no username is entered.
HashPasswd(passwd)
Returns a hash of the given password string.
UserAuthenticate(options=None, prompt='User', promptOnly=0)
Obtains a username and password hash, prompting for them, if necessary. Returns a tuple (username, password), which can be (None, None).
Username sources normally checked are, in order:
1. the options dictionary;
2. the agent referenced in the FTSS_AGENT environment variable;
3. the FTSS_USERNAME environment variable;
4. a prompt for user input.

Password sources normally checked are, in order:
1. the password file referenced in environment var. FTSS_PASSWORD_FILE;
2. the password file $HOME/.4ss.passwd or %WINDIR%\.4ss.passwd;
3. the password file referenced in the deprecated environment variable
   FTSERVER_PASSWORD_FILE;
4. a prompt for user input.

Optional arguments:

options - a dictionary of options parsed from the command line
(see FancyGetOpt). The key 'anonymous' is taken to indicate that no
authentication is necessary and (None, None) should be returned.
If the key 'username' is present, the associated value is returned as
the username and no other potential sources for username are checked.

prompt - if the user is to be prompted for their username, this is the
string that indicates the type of user to be mentioned in the prompt.
It is 'User' or 'Manager', typically.

promptOnly - if set, this flag forces the username and password to be
obtained by prompting the user; other sources are not checked.