Acquire.Identity._useraccount module

class UserAccount(username=None)[source]

Bases: object

This class holds all information about a user’s account, e.g. their username, the sanitised username for the person on the system, their account keys, status etc.

This data can be serialised to an from json to allow easy saving a retrieval from an object store

static from_data(data)[source]

Return a UserAccount constructed from the passed data (dictionary)

is_active()[source]

Return whether or not this is an active account

is_valid()[source]

Return whether or not this is a valid account

login_request_timeout()[source]

Return the number of hours a login request will remain active. This should normally be short, e.g. 30 minutes

login_root_url()[source]

Return the root URL used to log into this account

login_timeout()[source]

Return the maximum number of hours a single login can remain active. This should normally be of the order of 1-7 days, as individual calculations or workflows should not normally take longer than this

max_open_sessions()[source]

Return the maximum number of open login sessions (and open login requests) allowed for this user account

name()[source]

Return the name of this account

otp_secret()[source]

Return the encrypted one-time-password secret

private_key()[source]

Return the lines of the private key for this account

public_key()[source]

Return the lines of the public key for this account

reset_password(password)[source]

Call this function to reset the password of this account. Note that this will reset the password, returning the new OTP used to generate the 2FA one-time-codes

static sanitise_username(username)[source]

This function returns a sanitised version of the username. This will ensure that the username is valid (must be between 3 and 50 characters) and will remove anything problematic for the object store

sanitised_name()[source]

Return the sanitised username

set_keys(privkey, pubkey, secret=None)[source]

Set the private and public keys for this account. The keys can be set from files or from a binary read file..

status()[source]

Return the status for this account

to_data()[source]

Return a data representation of this object (dictionary)

uid()[source]

Return the globally unique ID for this account

username()[source]

Synonym for ‘name’

uuid()[source]

Return the globally unique ID for this account

validate_password(password, otpcode, remember_device=False, device_secret=None)[source]

Validate that the passed password and one-time-code are valid. If they are, then do nothing. Otherwise raise an exception. If ‘remember_device’ is true, then this returns the provisioning uri needed to initialise the OTP code for this account