univention.management.console.modules.passwordreset package

Contents

univention.management.console.modules.passwordreset package#

univention.management.console.modules.passwordreset.forward_to_master(func)[source]#
univention.management.console.modules.passwordreset.forward_to_master_if_authentication_disabled(func)[source]#
class univention.management.console.modules.passwordreset.ScanSettings(url: str, timeout: int, cafile: str | None, max_files: int)[source]#

Bases: NamedTuple

Settings of the malware scan, see malware_scan_settings().

Create new instance of ScanSettings(url, timeout, cafile, max_files)

url: str#

Alias for field number 0

timeout: int#

Alias for field number 1

cafile: str | None#

Alias for field number 2

max_files: int#

Alias for field number 3

univention.management.console.modules.passwordreset.scan_files_for_malware(files: list[tuple[str, bytes]], settings: ScanSettings, username: str | None) → None[source]#

Scan uploaded files with the ICAP server. This runs in a worker thread.

The function only gets prepared data, see uploaded_files() and malware_scan_settings(), so that it doesn’t touch shared state of the module. All scans of one request together must finish within the configured timeout.

Parameters:
  • files (list) – Pairs of property name and decoded file content.

  • settings (ScanSettings) – The URL, the timeout and the CA file of the ICAP server.

  • username (str) – The name of the user, for the log messages.

Raises:

UMC_Error – If the ICAP server finds malware or cannot scan a file.

univention.management.console.modules.passwordreset.malware_scan_settings() → ScanSettings[source]#

Get the settings of the malware scan: the URL, the timeout and the CA file of the ICAP server and the maximum number of files in one request.

The environment variables SELF_SERVICE_MALWARE_SCAN_ICAP_URL, SELF_SERVICE_MALWARE_SCAN_ICAP_TIMEOUT, SELF_SERVICE_MALWARE_SCAN_ICAP_CA_FILE and SELF_SERVICE_MALWARE_SCAN_MAX_FILES have priority over the UCR variables umc/self-service/malware-scan/icap/url, …/icap/timeout, …/icap/ca-file and …/max-files. Empty or invalid environment variables are ignored.

Returns:

The settings. The URL is empty if the scan is disabled, the CA file is None if the CA certificates of the system are used.

univention.management.console.modules.passwordreset.upload_values(property_descriptions: dict[str, Any], attributes: dict[str, Any]) → list[tuple[str, Any]][source]#

Collect the non-empty values of the attributes with an upload syntax from UPLOAD_SYNTAXES, for example jpegPhoto, without decoding them. Multivalue attributes, also extended attributes, give one entry per value.

Parameters:
  • property_descriptions (dict) – The UDM property descriptions of the users/user module.

  • attributes (dict) – The attribute values that the user sent.

Returns:

Pairs of property name and submitted value.

univention.management.console.modules.passwordreset.check_upload_limit(property_descriptions: dict[str, Any], attributes: dict[str, Any], settings: ScanSettings) → None[source]#

Reject a request with more uploaded files than allowed, before any file is decoded, validated or scanned.

The limit only applies when the malware scan is enabled. All non-empty values of all upload properties count, also values that are not valid Base64.

Parameters:
  • property_descriptions (dict) – The UDM property descriptions of the users/user module.

  • attributes (dict) – The attribute values that the user sent.

  • settings (ScanSettings) – The settings of the malware scan, max_files is the limit, 0 allows no file.

Raises:

UMC_Error – If the request contains more files than allowed.

univention.management.console.modules.passwordreset.uploaded_files(property_descriptions: dict[str, Any], attributes: dict[str, Any]) → list[tuple[str, bytes]][source]#

Decode the uploaded files in the attributes, see upload_values().

Values that are not Base64 are skipped, UDM rejects them later. Call check_upload_limit() first.

Parameters:
  • property_descriptions (dict) – The UDM property descriptions of the users/user module.

  • attributes (dict) – The attribute values that the user sent.

Returns:

Pairs of property name and decoded file content.

univention.management.console.modules.passwordreset.prevent_denial_of_service(func)[source]#
exception univention.management.console.modules.passwordreset.ConnectionLimitReached(seconds)[source]#

Bases: UMC_Error

status = 503#
exception univention.management.console.modules.passwordreset.ServiceForbidden[source]#

Bases: UMC_Error

status = 403#
exception univention.management.console.modules.passwordreset.TokenNotFound[source]#

Bases: UMC_Error

status = 400#
exception univention.management.console.modules.passwordreset.NoMethodsAvailable[source]#

Bases: UMC_Error

status = 403#
exception univention.management.console.modules.passwordreset.TokenSendMessage[source]#

Bases: UMC_Error

status = 200#
class univention.management.console.modules.passwordreset.Instance(*args, **kwargs)[source]#

Bases: Base

init()[source]#

this function is invoked after the module process started.

property usersmod#
get_service_specific_passwords(request)[source]#

Get users (possible) service specific passwords.

Returns:

list of dicts with users ssp

set_service_specific_passwords(request)[source]#

Set a new service specific password.

Returns:

The password in cleartext

get_contact(request)[source]#

Get users contact data.

Returns:

list of dicts with users contact data

get_user_attributes(request)[source]#
get_user_attributes_values(request)[source]#
get_user_attributes_descriptions(request, *args, **kwargs)[source]#
get_registration_attributes(request, *args, **kwargs)[source]#
validate_user_attributes(request)[source]#
set_user_attributes(request)[source]#
create_self_registered_account(request)[source]#
send_verification_token(request)[source]#
set_contact(request)[source]#
send_token(request)[source]#
verify_contact(request)[source]#
deregister_account(request)[source]#
set_password(request)[source]#
get_reset_methods(request, *args, **kwargs)[source]#
static create_token(length)[source]#
send_message(username, method, address, user_properties)[source]#
static auth(username, password, ldap_connection=None, ldap_position=None)[source]#
authenticate_user(username=None, password=None)[source]#

Check if the user is already authenticated (via UMC/SAML login) or use the credentials provided via the form.

set_contact_data(dn, email, mobile)[source]#
admember_set_password(username, password)[source]#
udm_set_password(username, password, email_verified)[source]#
is_blacklisted(username, feature, ldap_connection=None, ldap_position=None)[source]#
get_groups(userdn)[source]#
get_nested_groups(groupdn)[source]#
dns_to_groupname(dns)[source]#
get_udm_user_by_dn(userdn, admin=False)[source]#
get_udm_user(username, admin=False)[source]#
get_udm_group(groupdn, ldap_connection=None, ldap_position=None)[source]#
email2username(email, ldap_connection=None, ldap_position=None)[source]#

Subpackages#

Submodules#

univention.management.console.modules.passwordreset.send_plugin module#

class univention.management.console.modules.passwordreset.send_plugin.UniventionSelfServiceTokenEmitter(log)[source]#

Bases: object

base class

static send_method()[source]#
static send_method_label()[source]#
static message_application()[source]#
static is_enabled()[source]#
property udm_property#
password_reset_verified_recovery_email()[source]#
property token_length#
set_data(data)[source]#
send()[source]#

univention.management.console.modules.passwordreset.tokendb module#

exception univention.management.console.modules.passwordreset.tokendb.MultipleTokensInDB[source]#

Bases: Exception

class univention.management.console.modules.passwordreset.tokendb.TokenDB(logger)[source]#

Bases: object

cursor(*args, **kwargs)[source]#
insert_token(username, method, token)[source]#
update_token(username, method, token)[source]#
delete_tokens(**kwargs)[source]#
get_all(**kwargs)[source]#
get_one(**kwargs)[source]#
create_table()[source]#
open_db()[source]#
close_db()[source]#
table_exists()[source]#