linotp.model package¶
This file contains the database definition / database model for linotp objects
- wrt. the column name limitations see:
Common rules 1. Only letters, numbers, and the underscore are allowed in names. Although
Oracle allows $ and #, they are not necessary and may cause unexpected problems.
- All names are in UPPERCASE. Or at least of no importance which case.
Ignoring this rule usually leads referencing to tables and columns very clumsy because all names must be included in double quotes.
The first character in the name must be letter.
- Keep the names meaningful, but in the same time don’t use
long_names_describing_every_single_detail_of_particular_object.
- linotp.model.create_admin_realm(admin_realm_name, admin_resolver_name)¶
create the default managed admin realm
- linotp.model.create_admin_resolver(admin_resolver_name)¶
create the default managed admin resolver
to ease the programming, we work on an sql query result
- linotp.model.fix_db_encoding(app) None ¶
Fix the python2+mysql iso8859 encoding by conversion to utf-8.
- linotp.model.init_db_tables(app, drop_data=False, add_defaults=True)¶
Initialise LinOTP database tables.
This function initialises the LinOTP tables given an empty database (it also works if the database isn’t empty).
- Parameters
drop_data – If True, all data will be cleared. Use with caution!
add_defaults – Adds default configuration variables if True. Don’t set this to False unless you know what you are doing.
- linotp.model.set_defaults(app)¶
add linotp default config settings
- Returns
nothing -
- linotp.model.setup_db(app) None ¶
Set up the database for LinOTP.
This method is used to set up a SQLAlchemy database engine for the main LinOTP database. It does NOT generate a table structure if the database doesn’t have one (see init_db_tables() below for that).
This method is called during create_app(), which means that it happens pretty much always (during CLI commands and also when running from a WSGI application server), even before our own code really gets control. This is a hassle because we want to make sure that the database is properly initialised before going on our merry way, except when we know the database isn’t properly initialised and the next thing we’re about to do is to initialise it. This is why we have the revolting app.cli_cmd mechanism that is used below. It lets us skip the database setup when we’re doing linotp init or linotp config, both of which don’t touch the database, except for linotp init database, which skips the database setup during create_app() but then comes back to it in its own code after deviously setting app.cli_cmd to init-database so it goes into the if below after all. But in this case we still need to make an exception for it when it doesn’t find the Config table, because rather than croak with a fatal error we want to create the Config table.
FIXME: This is not how we would do this in Flask. We want to rewrite it once we get Flask-SQLAlchemy and Flask-Migrate working properly.
Subpackages¶
- linotp.model.schema package
- Submodules
- linotp.model.schema.challange_schema module
- linotp.model.schema.config_schema module
- linotp.model.schema.db_logging_schema module
- linotp.model.schema.imported_user_schema module
- linotp.model.schema.realm_schema module
- linotp.model.schema.reporting_schema module
- linotp.model.schema.token_realm_schema module
- linotp.model.schema.token_schema module
- Submodules
Submodules¶
- linotp.model.challange module
Challenge
Challenge.add_session_info()
Challenge.challenge
Challenge.checkChallengeSignature()
Challenge.close()
Challenge.createTransactionId()
Challenge.data
Challenge.get()
Challenge.getChallenge()
Challenge.getData()
Challenge.getId()
Challenge.getSession()
Challenge.getStatus()
Challenge.getTanCount()
Challenge.getTanStatus()
Challenge.getTokenSerial()
Challenge.getTransactionId()
Challenge.get_vars()
Challenge.id
Challenge.is_open()
Challenge.ochallenge
Challenge.odata
Challenge.oochallenge
Challenge.ptransid
Challenge.received_count
Challenge.received_tan
Challenge.save()
Challenge.session
Challenge.setChallenge()
Challenge.setData()
Challenge.setSession()
Challenge.setTanStatus()
Challenge.signChallenge()
Challenge.timestamp
Challenge.tokenserial
Challenge.transid
Challenge.valid_tan
- linotp.model.config module
- linotp.model.db_logging module
- linotp.model.imported_user module
ImportedUser
ImportedUser.create_password_hash()
ImportedUser.email
ImportedUser.givenname
ImportedUser.groupid
ImportedUser.list_users()
ImportedUser.mobile
ImportedUser.password
ImportedUser.phone
ImportedUser.remove_all_users()
ImportedUser.remove_user()
ImportedUser.set()
ImportedUser.surname
ImportedUser.update()
ImportedUser.user_entries
ImportedUser.userid
ImportedUser.username
NoSuchUserError
- linotp.model.local_admin_user module
- linotp.model.migrate module
MYSQL_Migration
Migration
Migration.db_model_key
Migration.get_current_version()
Migration.is_db_model_current()
Migration.is_db_untouched()
Migration.iso8859_to_utf8_conversion()
Migration.migrate()
Migration.migrate_2_10_1_0()
Migration.migrate_2_12_0_0()
Migration.migrate_2_9_1_0()
Migration.migrate_3_0_0_0()
Migration.migrate_3_1_0_0()
Migration.migrate_3_2_0_0()
Migration.migrate_3_2_2_0()
Migration.migrate_3_2_3_0()
Migration.migration_steps
Migration.set_version()
add_column()
add_index()
drop_column()
has_column()
re_encode()
run_data_model_migration()
- linotp.model.realm module
- linotp.model.reporting module
- linotp.model.resolver module
- linotp.model.token module
Token
Token.LinOtpCount
Token.LinOtpCountWindow
Token.LinOtpCreationDate
Token.LinOtpFailCount
Token.LinOtpIdResClass
Token.LinOtpIdResolver
Token.LinOtpIsactive
Token.LinOtpKeyEnc
Token.LinOtpKeyIV
Token.LinOtpLastAuthMatch
Token.LinOtpLastAuthSuccess
Token.LinOtpMaxFail
Token.LinOtpOtpLen
Token.LinOtpPinHash
Token.LinOtpSeed
Token.LinOtpSyncWindow
Token.LinOtpTokenDesc
Token.LinOtpTokenId
Token.LinOtpTokenInfo
Token.LinOtpTokenPinSO
Token.LinOtpTokenPinSOIV
Token.LinOtpTokenPinUser
Token.LinOtpTokenPinUserIV
Token.LinOtpTokenSerialnumber
Token.LinOtpTokenType
Token.LinOtpUserid
Token.copy_pin()
Token.deleteToken()
Token.get()
Token.getCountWindow()
Token.getDescription()
Token.getInfo()
Token.getOtpCounter()
Token.getRealmNames()
Token.getRealms()
Token.getSerial()
Token.getSyncWindow()
Token.getType()
Token.getUserPin()
Token.get_encrypted_pin()
Token.get_encrypted_seed()
Token.get_hashed_pin()
Token.get_vars()
Token.isPinEncrypted()
Token.realms
Token.setCountWindow()
Token.setDescription()
Token.setInfo()
Token.setOtpLen()
Token.setRealms()
Token.setSoPin()
Token.setType()
Token.setUserPin()
Token.set_encrypted_pin()
Token.set_encrypted_seed()
Token.set_hashed_pin()
Token.storeToken()
createToken()
- linotp.model.tokenRealm module