Package coilmq :: Package auth :: Module simple :: Class SimpleAuthenticator
[frames] | no frames]

Class SimpleAuthenticator

   object --+    
            |    
Authenticator --+
                |
               SimpleAuthenticator

A simple configfile-based authenticator.

Instance Methods
 
__init__(self, store=None)
Initialize the authenticator to use (optionally) specified dict store.
 
from_configfile(self, configfile)
Initialize the authentication store from a "config"-style file.
bool
authenticate(self, login, passcode)
Authenticate the login and passcode.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables

Inherited from Authenticator: __metaclass__

Instance Variables
dict of str to str store
Authentication key-value store (of logins to passwords).
Properties

Inherited from object: __class__

Method Details

__init__(self, store=None)
(Constructor)

 

Initialize the authenticator to use (optionally) specified dict store.

Parameters:
  • store (dict of str to str) - Authentication store, dict of logins to passwords.
Overrides: object.__init__

from_configfile(self, configfile)

 

Initialize the authentication store from a "config"-style file.

Auth "config" file is parsed with ConfigParser.RawConfigParser and must contain an [auth] section which contains the usernames (keys) and passwords (values).

Example auth file:

   [auth]
   someuser = somepass
   anotheruser = anotherpass
Parameters:
  • configfile (any) - Path to config file or file-like object.
Raises:
  • ValueError - If file could not be read or does not contain [auth] section.

authenticate(self, login, passcode)

 

Authenticate the login and passcode.

Returns: bool
Whether provided login and password match values in store.
Overrides: Authenticator.authenticate