linotp.tokens.voicetoken.voicetoken module¶
- class linotp.tokens.voicetoken.voicetoken.VoiceTokenClass(token_obj)¶
- Bases: - HmacTokenClass- Voice token class implementation - challenge is triggered and otp comes via phone call to the user - checkOtp(otp_value, counter, window, options=None)¶
- checkOtp - validate the token otp against a given otpvalue - Parameters
- otp_value (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 
 
 - checkResponse4Challenge(user, passw, options=None, challenges=None)¶
- verify the response of a previous challenge - Parameters
- user – requesting user 
- passw – to be checked pass (pin+otp) 
- options – an additional argument, which could be token specific 
- challenges – list of challenges, where each challenge is described as dict 
 
- Returns
- tuple containing a) otp counter and b) the list of matching challenges: (a,b) 
 - do the standard check for the response of the challenge + change the tokeninfo data of the last challenge 
 - createChallenge(transaction_id, options=None)¶
- create a challenge which is submitted to the user - Create a random counter and return it to the challenge dict, as well to the submit method which creates an otp for the phone call based on this counter. - Parameters
- transaction_id – the id of this challenge 
- options – the request context parameters / data 
 
- Returns
- tuple of (bool, message and data) bool, whether submit was successful message is submitted to the user data is preserved in the challenge attributes - additional attributes, which are added in to the - challenge dict (in the method which calls this method) 
 
 - classmethod getClassInfo(key=None, ret='all')¶
- getClassInfo - 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
- s.o. 
 
 - classmethod getClassPrefix()¶
 - classmethod getClassType()¶
- getClassType - return the token type shortname - Returns
- ‘voice’ 
 
 - getInitDetail(params, user=None)¶
- Returns additional details upon initialisation of the token 
 - getOtp(curTime=None)¶
- :raises NotImplementedError 
 - get_mobile_number(user=None)¶
- get the mobile number
- from the token info or 
- if the policy allowes it, from the user info 
 
 
 - get_phone()¶
- getter for the phone number - Returns
- phone number 
- Return type
- string 
 
 - initChallenge(transaction_id, challenges=None, options=None)¶
- initialize the challenge - Parameters
- transaction_id – the id of the new challenge 
- challenges – the challenges list. 
- options – the request parameters 
 
- Returns
- tuple of success - bool trans_id - the best transaction id for this request context message - which is shown to the user attributes - further info (dict) shown to the user 
 
 - is_challenge_request(passw, user, options=None)¶
- check if the request would start a challenge - default: if the passw contains only the pin, this request would
- trigger a challenge 
 
- in this place as well the policy for a token is checked 
 - Parameters
- passw – password, which might be pin or pin+otp 
- options – dictionary of additional request parameters 
 
- Returns
- returns true or false 
 
 - is_challenge_response(passw, user, options=None, challenges=None)¶
- check if the request contains the result of a challenge - Parameters
- passw – password, which might be pin or pin+otp 
- user – the requesting user 
- options – dictionary of additional request parameters 
- challenges – Not used in this method #TODO 
 
- Returns
- returns true or false 
 
 - set_phone(phone)¶
- setter for the phone number - Parameters
- phone (string) – phone number 
 
 - update(param, reset_fail_count=True)¶
- token initialization with user parameters - Parameters
- param – dict of initialization parameters 
 - :param reset_fail_count : boolean if the fail count should be reset - Returns
- nothing 
 
 
- linotp.tokens.voicetoken.voicetoken.get_voice_language(user='', realm='')¶
- This function returns the voice language as defined in the policy authentication/voice_language. If no such policy is defined, the function returns the fallback message “en” - Returns
- string 
 
- linotp.tokens.voicetoken.voicetoken.get_voice_message(user='', realm='')¶
- This function returns the voice message as defined in the policy authentication/voice_message. If no such policy is defined, the function returns the fallback message “{otp}” - Returns
- string