keystone.receipt.receipt_formatters 模块¶
- class keystone.receipt.receipt_formatters.ReceiptFormatter[source]¶
基类:
object打包和解包有效载荷,以便进行传输。
- property crypto¶
返回一个密码学实例。
你可以通过自定义 crypto @property 来扩展此类,以提供你自己的收据编码/解码。例如,使用不同的密码学库(例如
python-keyczar)或满足任意安全要求。此 @property 只需要返回一个实现
encrypt(plaintext)和decrypt(ciphertext)的对象。
- class keystone.receipt.receipt_formatters.ReceiptPayload[source]¶
基类:
object- classmethod assemble(user_id, methods, expires_at)[source]¶
组装收据的有效载荷。
- 参数:
user_id – 收据请求中的用户标识符
methods – 使用的身份验证方法列表
expires_at – 收据的到期时间
- 返回值:
收据的有效载荷
- classmethod attempt_convert_uuid_hex_to_bytes(value)[source]¶
尝试将值转换为字节或返回该值。
- 参数:
value – 要尝试转换为字节的值
- 返回值:
包含一个布尔值,指示 user_id 是否存储为字节,以及 uuid 值是否为字节,或者原始值
- classmethod convert_uuid_bytes_to_hex(uuid_byte_string)[source]¶
根据字节字符串生成 uuid.hex 格式。
- 参数:
uuid_byte_string – 要生成的 uuid 字符串
- 返回值:
uuid hex 格式化的字符串
- classmethod convert_uuid_hex_to_bytes(uuid_string)[source]¶
将 UUID 格式化的字符串压缩为字节。
- 参数:
uuid_string – 要压缩为字节的 uuid 字符串
- 返回值:
uuid 的字节表示形式