linotp.lib.challenges module¶
- class linotp.lib.challenges.Challenges¶
Bases:
object
- DefaultTransactionIdLength = 17¶
- static create_challenge(token, options=None, challenge_id=None, id_postfix='')¶
dedicated method to create a challenge to support the implementation of challenge policies in future
- Parameters
options – optional parameters for token specific tokens eg. request a signed challenge
- Returns
a tuple of (boolean, and a dict, which contains the {‘challenge’ : challenge} description)
- static delete_challenges(serial, challenges)¶
delete some challenges of a token
- Parameters
serial – the serial number of the token
challenges – list of (dict|int|str|challenge objects)
- Returns
result of the delete operation
- static finish_challenges(token, success=False)¶
preserve the token challenge status
- Parameters
token – the token where the challenges belong to
success – boolean value to indicate if it was processed successfully or not
- Returns
nothing -
- static get_challenges(token=None, transid=None, options=None, filter_open=False)¶
- static get_transactionid_length()¶
get transaction id length from config and check if it is in range :return: length of transaction id
handle related challenges and close these
- Parameters
matching_challenges – all challenges that have been correctly answered
- static lookup_challenges(serial=None, transid=None, filter_open=False)¶
database lookup to find all challenges belonging to a token and or if exist with a transaction state
- Parameters
serial – serial of the token
transid – transaction id, if None, all will be retrieved
filter_open – check only for those challenges, which have not been verified before
- Returns
return a list of challenge dict
- static verify_checksum(challenge)¶
verify that the challenge data was not modified on db level
- Parameters
challenge – challenge object
- Returns
success boolean
- linotp.lib.challenges.transaction_id_to_u64(transaction_id)¶
converts a transaction_id to u64 format (used in the challenge-url format) transaction_ids come in 2 formats:
Normal Transaction - 49384
Subtransaction - 213123.39
where the 2 places behind the point start with 01.
The function converts the strings by “multiplying” it with 100, so we well get 4938400 and 21312339