linotp.lib.config module

handle all configuration items with aspekts like persitance and syncronysation and provides this to all requests

class linotp.lib.config.LinOtpConfig(*args, **kw)[source]

Bases: dict

This class should be a request singleton.

In case of a change, it must cover the different aspects like

  • env config entry
  • and app_globals
  • and finally sync this to disc
addEntry(key, val, typ=None, des=None)[source]

small wrapper, as the assignement opperator has only one value argument

Parameters:
  • key (string) – key of the dict
  • val (any type) – any value, which is put in the dict
  • typ (None,string,password) – used in the database to control if the data is encrypted
  • des (string) – literal, which describes the data
get(key, default=None)[source]

check for a key in the linotp config

remark: the config entries all start with linotp. if a key is not found, we do a check if there is a linotp. prefix set in the key and potetialy prepend it

Parameters:
  • key (string) – search value
  • default (any type) – default value, which is returned, if the value is not found
Returns:

value or None

Return type:

any type

getRealms()[source]
has_key(key)[source]
refreshConfig(do_reload=False)[source]
setRealms(realmDict)[source]
update(dic)[source]

update the config dict with multiple items in a dict

Parameters:dic (dict) – dictionary of multiple items

:return : return the std value like the std dict does, whatever this is :rtype : any value a dict update will return

linotp.lib.config.getFromConfig(key, defVal=None)[source]
linotp.lib.config.getGlobalObject()[source]
linotp.lib.config.getLinotpConfig()[source]

return the thread local dict with all entries

Returns:local config dict
Return type:dict
linotp.lib.config.initLinotpConfig()[source]

return the linotpConfig class, which is integrated in the local thread context

Returns:thread local LinOtpConfig
Return type:LinOtpConfig Class
linotp.lib.config.refreshConfig()[source]
linotp.lib.config.removeFromConfig(key, iCase=False)[source]
linotp.lib.config.setDefaultCountWindow(countWindowSize)[source]
linotp.lib.config.setDefaultMaxFailCount(maxFailCount)[source]
linotp.lib.config.setDefaultOtpLen(otpLen)[source]
linotp.lib.config.setDefaultResetFailCount(resetFailCount)[source]
linotp.lib.config.setDefaultSyncWindow(syncWindowSize)[source]
linotp.lib.config.storeConfig(key, val, typ=None, desc=None)[source]
linotp.lib.config.updateConfig(confi)[source]

update the server config entries incl. syncing it to disc