keystone.identity.backends.base 模块¶
- class keystone.identity.backends.base.IdentityDriverBase[source]¶
基类:
object身份驱动程序的接口描述。
用户和组的模式取决于驱动程序是否感知域(如 self.is_domain_aware() 返回)。
如果驱动程序不感知域
domain_id 将不会包含在传递给 create_user / create_group 的用户 / 组中
domain_id 不应在用户 / 组引用中返回。它们将被覆盖。
用户模式中的 password_expires_at 属性是只读属性,这意味着它预计在响应中,而不是在请求中。
用户模式(如果驱动程序感知域)
type: object properties: id: type: string name: type: string domain_id: type: string password: type: string password_expires_at: type: datetime enabled: type: boolean default_project_id: type: string required: [id, name, domain_id, enabled] additionalProperties: True
用户模式(如果驱动程序不感知域)
type: object properties: id: type: string name: type: string password: type: string password_expires_at: type: datetime enabled: type: boolean default_project_id: type: string required: [id, name, enabled] additionalProperties: True # Note that domain_id is not allowed as a property
组模式(如果驱动程序感知域)
type: object properties: id: type: string name: type: string domain_id: type: string description: type: string required: [id, name, domain_id] additionalProperties: True
组模式(如果驱动程序不感知域)
type: object properties: id: type: string name: type: string description: type: string required: [id, name] additionalProperties: True # Note that domain_id is not allowed as a property
- abstract add_user_to_group(user_id, group_id)[source]¶
将用户添加到组。
- 参数:
user_id (str) – 用户 ID。
group_id (str) – 组 ID。
- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
keystone.exception.GroupNotFound – 如果组不存在。
- abstract authenticate(user_id, password)[source]¶
验证给定的用户和密码。
- 参数:
user_id (str) – 用户 ID
password (str) – 密码
- 返回值:
用户。请参阅
IdentityDriverBase中的用户模式。- 返回类型:
dict
- 引发:
AssertionError – 如果用户或密码无效。
- abstract change_password(user_id, new_password)[source]¶
自助密码更改。
- 参数:
user_id (str) – 用户 ID。
new_password (str) – 新密码。
- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
keystone.exception.PasswordValidation – 如果密码验证失败
- abstract check_user_in_group(user_id, group_id)[source]¶
检查用户是否是组的成员。
- 参数:
user_id (str) – 用户 ID。
group_id (str) – 组 ID。
- 引发:
keystone.exception.NotFound – 如果用户不是该组的成员。
keystone.exception.UserNotFound – 如果用户不存在。
keystone.exception.GroupNotFound – 如果组不存在。
- abstract create_group(group_id, group)[source]¶
创建一个新组。
- 参数:
group_id (str) – 组 ID。驱动程序可以忽略此值。
group (dict) – 组信息。请参阅
IdentityDriverBase中的组模式。
- 返回值:
组,匹配组模式。
- 返回类型:
dict
- 引发:
keystone.exception.Conflict – 如果存在重复组。
- abstract create_user(user_id, user)[source]¶
创建一个新用户。
- 参数:
user_id (str) – 用户 ID。驱动程序可以忽略此值。
user (dict) – 用户信息。请参阅
IdentityDriverBase中的用户模式。驱动程序不应返回密码。
- 返回值:
用户,匹配用户模式。
- 返回类型:
dict
- 引发:
keystone.exception.Conflict – 如果存在重复用户。
- abstract delete_group(group_id)[source]¶
删除现有组。
- 参数:
group_id (str) – 组 ID。
- 引发:
keystone.exception.GroupNotFound – 如果组不存在。
- abstract delete_user(user_id)[source]¶
删除现有用户。
- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
- abstract get_group(group_id)[source]¶
按 ID 获取组。
- 参数:
group_id (str) – 组 ID。
- 返回值:
组信息。请参阅
IdentityDriverBase中的组模式。- 返回类型:
dict
- 引发:
keystone.exception.GroupNotFound – 如果组不存在。
- abstract get_group_by_name(group_name, domain_id)[source]¶
按名称获取组。
- 参数:
group_name (str) – 组名称。
domain_id (str) – 域 ID。
- 返回值:
组信息。请参阅
IdentityDriverBase中的组模式。- 返回类型:
dict
- 引发:
keystone.exception.GroupNotFound – 如果组不存在。
- abstract get_user(user_id)[source]¶
按 ID 获取用户。
- 参数:
user_id (str) – 用户 ID。
- 返回值:
用户。请参阅
IdentityDriverBase中的用户模式。- 返回类型:
dict
- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
- abstract get_user_by_name(user_name, domain_id)[source]¶
按名称获取用户。
- 返回值:
user_ref
- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
- property is_sql¶
指示此驱动程序是否使用 SQL。
- abstract list_groups(hints)[source]¶
列出系统中的组。
- 参数:
hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。
- 返回值:
组引用列表或空列表。请参阅
IdentityDriverBase中的组模式。
- abstract list_groups_for_user(user_id, hints)[source]¶
列出用户所属的组。
- 参数:
user_id (str) – 正在查询的用户
hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。
- 返回值:
组引用列表或空列表。请参阅
IdentityDriverBase中的组模式。- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
- abstract list_users(hints)[source]¶
列出系统中的用户。
- 参数:
hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。
- 返回值:
用户列表或空列表。请参阅
IdentityDriverBase中的用户模式。- 返回类型:
字典列表
- abstract list_users_in_group(group_id, hints)[source]¶
列出组中的用户。
- 参数:
group_id (str) – 正在查询的组
hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。
- 返回值:
用户列表或空列表。请参阅
IdentityDriverBase中的用户模式。- 返回类型:
字典列表
- 引发:
keystone.exception.GroupNotFound – 如果组不存在。
- property multiple_domains_supported¶
- abstract remove_user_from_group(user_id, group_id)[source]¶
从组中删除用户。
- 参数:
user_id (str) – 用户 ID。
group_id (str) – 组 ID。
- 引发:
keystone.exception.NotFound – 如果用户不在该组中。
- abstract reset_last_active()[source]¶
重置 null last_active_at 值。
此方法查找数据库中所有 last_updated_at 值为 null 的用户,并将该值重置为当前时间。
- abstract unset_default_project_id(project_id)[source]¶
给定特定的项目 ID,取消设置用户的默认项目。
- 参数:
project_id (str) – 项目 ID
- abstract update_group(group_id, group)[source]¶
更新现有组。
- 参数:
group_id (str) – 组 ID。
group (dict) – 组修改。请参阅
IdentityDriverBase中的组模式。不允许删除必需的属性。
- 返回值:
组,匹配组模式。
- 返回类型:
dict
- 引发:
keystone.exception.GroupNotFound – 如果组不存在。
keystone.exception.Conflict – 如果存在重复组。
- abstract update_user(user_id, user)[source]¶
更新现有用户。
- 参数:
user_id (str) – 用户 ID。
user (dict) – 用户修改。请参阅
IdentityDriverBase中的用户模式。设置为 None 的属性将被移除。必需属性不能被移除。
- 返回值:
用户。请参阅
IdentityDriverBase中的用户模式。- 引发:
keystone.exception.UserNotFound – 如果用户不存在。
keystone.exception.Conflict – 如果在同一域中存在重复的用户。