b.c.AuthenticationConfig(object) : class documentation

Part of bzrlib.config View In Hierarchy

The authentication configuration file based on a ini file.

Implements the authentication.conf file described in doc/developers/authentication-ring.txt.

Method __init__ Undocumented
Method get_credentials Returns the matching credentials from authentication.conf file.
Method set_credentials Set authentication credentials for a host.
Method get_user Get a user from authentication file.
Method get_password Get a password from authentication file or prompt the user for one.
Method decode_password Undocumented
Method _get_config Undocumented
Method _save Save the config file, only tests should use it for now.
Method _set_option Set an authentication configuration option
def __init__(self, _file=None):
Undocumented
def _get_config(self):
Undocumented
def _save(self):
Save the config file, only tests should use it for now.
def _set_option(self, section_name, option_name, value):
Set an authentication configuration option
def get_credentials(self, scheme, host, port=None, user=None, path=None, realm=None):
Returns the matching credentials from authentication.conf file.

:param scheme: protocol

:param host: the server address

:param port: the associated port (optional)

:param user: login (optional)

:param path: the absolute path on the server (optional)

:param realm: the http authentication realm (optional)

:return: A dict containing the matching credentials or None.
   This includes:
   - name: the section name of the credentials in the
     authentication.conf file,
   - user: can't be different from the provided user if any,
   - scheme: the server protocol,
   - host: the server address,
   - port: the server port (can be None),
   - path: the absolute server path (can be None),
   - realm: the http specific authentication realm (can be None),
   - password: the decoded password, could be None if the credential
     defines only the user
   - verify_certificates: https specific, True if the server
     certificate should be verified, False otherwise.
def set_credentials(self, name, host, user, scheme=None, password=None, port=None, path=None, verify_certificates=None, realm=None):
Set authentication credentials for a host.

Any existing credentials with matching scheme, host, port and path will be deleted, regardless of name.

ParametersnameAn arbitrary name to describe this set of credentials.
hostName of the host that accepts these credentials.
userThe username portion of these credentials.
schemeThe URL scheme (e.g. ssh, http) the credentials apply to.
passwordPassword portion of these credentials.
portThe IP port on the host that these credentials apply to.
pathA filesystem path on the host that these credentials apply to.
verify_certificatesOn https, verify server certificates if True.
realmThe http authentication realm (optional).
def get_user(self, scheme, host, port=None, realm=None, path=None, prompt=None, ask=False, default=None):
Get a user from authentication file.
Parametersschemeprotocol
hostthe server address
portthe associated port (optional)
realmthe realm sent by the server (optional)
paththe absolute path on the server (optional)
askAsk the user if there is no explicitly configured username (optional)
defaultThe username returned if none is defined (optional).
ReturnsThe found user.
def get_password(self, scheme, host, user, port=None, realm=None, path=None, prompt=None):
Get a password from authentication file or prompt the user for one.
Parametersschemeprotocol
hostthe server address
portthe associated port (optional)
userlogin
realmthe realm sent by the server (optional)
paththe absolute path on the server (optional)
ReturnsThe found password or the one entered by the user.
def decode_password(self, credentials, encoding):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.