16.2.1.15.22. TAN Token

class privacyidea.lib.tokens.tantoken.TanTokenClass(db_token)[source]

The TAN token allows to print out the next e.g. 100 OTP values. This sheet of paper can be used to authenticate and strike out the used OTP values. In contrast to the paper token, the OTP values of the TAN token can be used randomly.

This creates a new TAN token object from a DB token object.

Parameters:

db_token (orm object) – instance of the orm db object

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

check if the given OTP value is valid for this token.

Parameters:
  • anOtpVal (string) – the to be verified otpvalue

  • counter (int) – the counter state, that should be verified

  • window (int) – the counter +window, which should be checked

  • options (dict) – the dict, which could contain token specific info

Returns:

the counter state or -1

Return type:

int

get_as_dict()[source]

This returns the token data as a dictionary. It is used to display the token list at /token/list.

The TAN token class removes the tan.tanXX information and only returns the number of remaining tans.

Returns:

The token data as dict

Return type:

dict

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]

Return the prefix, that is used as a prefix for the serial numbers. :return: PITN

static get_class_type()[source]

return the token type shortname

Returns:

‘paper’

Return type:

string

static get_import_csv(row)[source]

Read the list from a csv file and return a dictionary, that can be used to do a token_init.

Parameters:

row (list) – The list of the line of a csv file

Returns:

A dictionary of init params

owned_tokeninfo_prefixes = frozenset({'tan.'})
update(param, reset_failcount=True)[source]

process the initialization parameters

Do we really always need an otpkey? the otpKey is handled in the parent class

Parameters:
  • param (dict) – dict of initialization parameters

  • reset_failcount (bool) – reset the failcount