authorisation Module

This module contains the authorisation classes. They look up user information from various sources and validate a username/password pair against entries in the user table.

class pymail.authorisation.Authorisation(session, config)

Bases: object

Base class for authorisation classes

__init__(session, config)

Create Authorisation object

Parameters:
  • session (Smtp) –
  • config (dict) –
authorize(_username, _password)

Authorize user with password

Parameters:
  • username (string) –
  • password (string) –
Returns:

True if authorized

config = None

Config subsection

session = None

Session (Smtp)

class pymail.authorisation.ConfigAuthorisation(session, config)

Bases: pymail.authorisation.Authorisation

Authorisation from users subsection in config file

User accounts are defined in config section authorisation.users. A user definition consists of the following entries:

A key with the username mapping a string with the password, like in:

authorisation:
    users:
        jack: box
        jill: 0v3rth3h177

It should be common sense that this is not the proper place to define user accounts. Use this only for testing or if there are only a handful of users.