linotp.lib.tokens.motptoken module

This file containes the mOTP token implementation: - http://motp.sourceforge.net/ -

class linotp.lib.tokens.motptoken.MotpTokenClass(a_token)[source]

Bases: linotp.lib.tokenclass.TokenClass

implementation of the mOTP token class - see: http://motp.sourceforge.net/

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

checkOtp - validate the token otp against a given otpvalue

Parameters:
  • anOtpVal (string) – the to be verified otpvalue
  • counter (int) – the counter state, that shoule 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

classmethod getClassInfo(key=None, ret='all')[source]

getClassInfo - returns all or 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

:rtype : s.o.

classmethod getClassPrefix()[source]
classmethod getClassType()[source]

static method to return the token class identifier

Returns:fixed string
update(param, reset_failcount=True)[source]

update - process initialization parameters

Parameters:param (dict) – dict of initialization parameters
Returns:nothing