linotp.settings module

class linotp.settings.Config

Bases: object

ACTIVE_SECURITY_MODULE = 'default'
ADMIN_PASSWORD = ''
ADMIN_REALM_NAME = 'linotp_admins'
ADMIN_RESOLVER_NAME = 'LinOTP_local_admins'
ADMIN_USERNAME = ''
AUDIT_DATABASE_URI = 'SHARED'
AUDIT_ERROR_ON_TRUNCATION = False
AUDIT_PRIVATE_KEY_FILE = 'audit-private.pem'
AUDIT_PUBLIC_KEY_FILE = 'audit-public.pem'
BABEL_DOMAIN = 'linotp'
BABEL_TRANSLATION_DIRECTORIES = 'i18n'
BACKUP_DIR = 'backup'
BACKUP_FILE_TIME_FORMAT = '%Y-%m-%d_%H-%M'
BEAKER_CACHE_TYPE = 'memory'
CACHE_DIR = 'cache'
CONTROLLERS = 'admin audit auth gettoken maintenance manage monitoring reporting selfservice system tools userservice validate'
CUSTOM_TEMPLATES_DIR = None
DATABASE_URI = 'sqlite:///{}'
DATA_DIR = 'data'
HELP_URL = 'https://linotp.org/doc/{0}/index.html'
HSM_DEFAULT_CONFIG = {'configHandle': 1, 'crypted': 'FALSE', 'defaultHandle': 0, 'module': 'linotp.lib.security.default.DefaultSecurityModule', 'poolsize': 20, 'tokenHandle': 2, 'valueHandle': 3}
HSM_PKCS11_CONFIG = {'configHandle': None, 'configLabel': '', 'defaultHandle': None, 'defaultLabel': 'default', 'library': 'libCryptoki2_64.so', 'module': 'linotp.lib.security.pkcs11.Pkcs11SecurityModule', 'password': '<your password>', 'poolsize': 10, 'slotid': 0, 'tokenHandle': None, 'tokenLabel': '', 'valueHandle': None, 'valueLabel': ''}
JWT_ACCESS_TOKEN_EXPIRES = 900
JWT_ACCESS_TOKEN_REFRESH = 300
JWT_CSRF_CHECK_FORM = True
JWT_SECRET_ITERATIONS = 500000
JWT_SECRET_KEY = None
JWT_SECRET_SALT = b'\xc9\x8a\x109\xa4\x10\x15$4s\xf2\xc4\xc4\x0b\xacq'
JWT_TOKEN_LOCATION = 'cookies'
LOGGING = None
LOGGING_CONSOLE_LEVEL = 'WARNING'
LOGGING_FILE_LEVEL = 'WARNING'
LOGGING_LEVEL = 'INFO'
LOGGING_SQLALCHEMY_LEVEL = 'WARNING'
LOG_CONSOLE_LINE_FORMAT = '%(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
LOG_FILE_DIR = 'logs'
LOG_FILE_LINE_FORMAT = '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
LOG_FILE_MAX_LENGTH = 10485760
LOG_FILE_MAX_VERSIONS = 10
LOG_FILE_NAME = 'linotp.log'
MAINTENANCE_VERIFY_CLIENT_ENV_VAR = ''
MAKO_DEFAULT_FILTERS = ['h']
MAKO_TRANSLATE_EXCEPTIONS = False
PROFILE = False
RADIUS_NAS_IDENTIFIER = 'LinOTP'
ROOT_DIR = ''
SECRET_FILE = 'encKey'
SITE_ROOT_REDIRECT = ''
SQLALCHEMY_TRACK_MODIFICATIONS = False
TLS_CA_CERTIFICATES_FILE = '/etc/ssl/certs/ca-certificates.crt'
TOKEN_MODULES = ''
static init_app(app)
class linotp.settings.ConfigItem(name: str, type: ~typing.Type = <class 'str'>, convert: ~typing.Optional[~typing.Callable[[str], ~typing.Type]] = None, validate: ~typing.Optional[~typing.Callable[[str, ~typing.Any], None]] = None, default: ~typing.Optional[~typing.Any] = None, help: str = '')

Bases: object

This class represents individual configuration settings. A ConfigSchema is basically a dictionary of ConfigItem instances.

convert: Callable[[str], Type] = None
default: Any = None
help: str = ''
name: str
type

alias of str

validate: Callable[[str, Any], None] = None
class linotp.settings.ConfigSchema(schema=None, refuse_unknown=False)

Bases: object

This class represents a complete schema of configuration settings.

as_dict()

Return the names and default values of the schema as a dictionary. This is useful to populate the configuration with initial values without having to repeat any of the defaults.

check_item(key, value)

Converts a new value for a configuration item to the proper type (according to the ConfigItem data structure for the item) and also applies the validate function if one is defined for the item. We’re only doing the type conversion if the type of the value parameter is str; if people are using different types in their configuration files we assume that they know what they’re doing.

find_item(key)

Returns the ConfigItem instance for the configuration item called key if it exists, otherwise None.

items()

Return the names and schema items of the schema as a dictionary (generator really). Note that this is similar but not identical to the .as_dict() method.

class linotp.settings.DevelopmentConfig

Bases: Config

DATABASE_URI = 'sqlite:////usr/lib/python3/dist-packages/linotp-dev.sqlite'
DEBUG = True
LOGGING_FILE_LEVEL = 'DEBUG'
LOGGING_LEVEL = 'DEBUG'
exception linotp.settings.LinOTPConfigKeyError

Bases: KeyError

Used for LinOTP configuration items with invalid names.

exception linotp.settings.LinOTPConfigValueError

Bases: ValueError

Used for out-of-range errors etc. with LinOTP configuration items.

class linotp.settings.ProductionConfig

Bases: Config

DATABASE_URI = 'sqlite:////usr/lib/python3/dist-packages/linotp.sqlite'
class linotp.settings.TestingConfig

Bases: Config

DATABASE_URI = 'sqlite:////usr/lib/python3/dist-packages/linotp-test.sqlite'
LOGGING_LEVEL = 'DEBUG'
TESTING = True
linotp.settings.check_absolute_pathname()

Factory function that will return a function that ensures that value is an absolute path name. Used to check ROOT_DIR.

linotp.settings.check_int_in_range(min=None, max=None)

Factory function that will return a function that ensures that min <= value <= max. If min or max are not given, the practically default to “negative infinity” and “positive infinity”, respectively.

linotp.settings.check_json_schema(schema={})

Factory function that will return a function that ensures that value agrees to the schema

linotp.settings.check_membership(allowed={})

Factory function that will return a function that ensures that value is contained in allowed (the set of allowed values).