linotp.model.challange module

class linotp.model.challange.Challenge(transid, tokenserial, challenge='', data='', session='')

Bases: ChallengeSchema

add_session_info(info: Any) None
challenge
checkChallengeSignature(hsm: DefaultSecurityModule) bool

check the integrity of a challenge

Parameters

hsm – security module

Returns

success - boolean

close() None

close a session and make it invisible to the validation

remarks:

we introduce the challenge status ‘closed’. It is set after a first successful authentication. The status is required, as we don’t remove the challenges after validation anymore

classmethod createTransactionId(length: int = 20) str
data
get(key: Optional[str] = None, fallback: Optional[Any] = None, save: bool = False) Union[None, dict]

simulate the dict behaviour to make challenge processing easier, as this will have to deal as well with ‘dict only challenges’

Parameters
  • key – the attribute name - in case key is not provided, a dict of all class attributes is returned

  • fallback – if the attribute is not found, the fallback is returned

  • save – in case of all attributes and save==True, the timestamp is converted to a string representation

getChallenge() str
getData() Union[dict, str]
getId() int
getSession() str
getStatus() bool

check if the session is already closed

Returns

success - boolean

getTanCount() int
getTanStatus() Tuple[bool, bool]
getTokenSerial() str
getTransactionId() str
get_vars(save: bool = False) dict

return a dictionary of all vars in the challenge class

Returns

dict of vars

id
is_open() bool

check if the session is already closed

Returns

success - boolean

ochallenge
odata
oochallenge
ptransid
received_count
received_tan
save() str

enforce the saving of a challenge - will guarantee the uniqness of the transaction id

Returns

transaction id of the stored challenge

session
setChallenge(challenge: str) None
setData(data: Any) None
setSession(session: str) None

set the session state information like open or closed - contains in addition the mac of the whole challenge entry

Parameters

session – dictionary of the session info

setTanStatus(received: bool = False, valid: bool = False, increment: bool = True) None
signChallenge(hsm: DefaultSecurityModule) None

create a challenge signature and preserve it

Parameters

hsm – security module, which is able to calc the signature

Returns

  • nothing -

timestamp
tokenserial
transid
valid_tan