17.2.1.16.13. PasswordToken

class privacyidea.lib.tokens.passwordtoken.PasswordTokenClass(aToken)[source]

This Token does use a fixed Password as the OTP value. In addition, the OTP PIN can be used with this token. This Token can be used for a scenario like losttoken

The enrollment policies <type>.length and <type>.contents define a generated password, see get_password_policy_actions(). The prepolicy applies them to every subclass and ignores request parameters with these names. A subclass must therefore add get_password_policy_definitions() to the enrollment policies in its get_class_info(). Otherwise an administrator can not set these policies and the defaults of the class apply.

Create a new token object.

Parameters:

db_token (Token) – A database token object

Returns:

A TokenClass object

class SecretPassword(secObj)[source]
check_password(password)[source]
Parameters:

password (str)

Returns:

result of password check: 0 if success, -1 if failed

Return type:

int

get_password()[source]
check_otp(anOtpVal, counter=None, window=None, options=None)[source]

This checks the static password

Parameters:

anOtpVal – This contains the “OTP” value, which is the static password

Returns:

result of password check, 0 in case of success, -1 if fail

Return type:

int

default_contents = 'cn'
default_length = 12
static get_class_info(key=None, ret='all')[source]

returns a subtree of the token definition

Parameters:
  • key (string) – subsection identifier

  • ret (user defined) – default return value, if nothing is found

Returns:

subsection if key exists or user defined

Return type:

dict or scalar

static get_class_prefix()[source]
static get_class_type()[source]
get_init_detail(params=None, user=None)[source]

At the end of the initialization we return the registration code.

classmethod get_password_policy_actions() → tuple[str, str][source]

Return the names of the enrollment policy actions, which define the length and the contents of a generated password, e.g. ("pw.length", "pw.contents"). The prepolicy passes their values to the token in the request parameters of the same names.

classmethod get_password_policy_definitions(length_desc: str, contents_desc: str) → dict[source]

Return the definitions of the enrollment policy actions for the length and the contents of a generated password.

Parameters:
  • length_desc – The description of the length action

  • contents_desc – The description of the contents action

Returns:

The policy definitions

password_detail_key = 'password'
update(param)[source]

This method is called during the initialization process. :param param: parameters from the token init :type param: dict :return: None