keystone.receipt.receipt_formatters module¶
- class keystone.receipt.receipt_formatters.ReceiptFormatter[source]¶
- Bases: - object- Packs and unpacks payloads into receipts for transport. - create_receipt(user_id, methods, expires_at)[source]¶
- Given a set of payload attributes, generate a Fernet receipt. 
 - classmethod creation_time(fernet_receipt)[source]¶
- Return the creation time of a valid Fernet receipt. 
 - property crypto¶
- Return a cryptography instance. - You can extend this class with a custom crypto @property to provide your own receipt encoding / decoding. For example, using a different cryptography library (e.g. - python-keyczar) or to meet arbitrary security requirements.- This @property just needs to return an object that implements - encrypt(plaintext)and- decrypt(ciphertext).
 
- class keystone.receipt.receipt_formatters.ReceiptPayload[source]¶
- Bases: - object- classmethod assemble(user_id, methods, expires_at)[source]¶
- Assemble the payload of a receipt. - Parameters:
- user_id – identifier of the user in the receipt request 
- methods – list of authentication methods used 
- expires_at – datetime of the receipt’s expiration 
 
- Returns:
- the payload of a receipt 
 
 - classmethod attempt_convert_uuid_hex_to_bytes(value)[source]¶
- Attempt to convert value to bytes or return value. - Parameters:
- value – value to attempt to convert to bytes 
- Returns:
- tuple containing boolean indicating whether user_id was stored as bytes and uuid value as bytes or the original value 
 
 - classmethod convert_uuid_bytes_to_hex(uuid_byte_string)[source]¶
- Generate uuid.hex format based on byte string. - Parameters:
- uuid_byte_string – uuid string to generate from 
- Returns:
- uuid hex formatted string 
 
 - classmethod convert_uuid_hex_to_bytes(uuid_string)[source]¶
- Compress UUID formatted strings to bytes. - Parameters:
- uuid_string – uuid string to compress to bytes 
- Returns:
- a byte representation of the uuid 
 
 
