keystoneauth1.extras.oauth1.v3 模块

OAuth 身份验证插件。

警告

此模块需要安装额外的包(oauthlib),默认情况下未安装。如果没有安装额外的包,将会发生导入错误。可以使用以下命令安装额外的包:

$ pip install keystoneauth['oauth1']
class keystoneauth1.extras.oauth1.v3.OAuth1(auth_url: str, consumer_key: str, consumer_secret: str, access_key: str, access_secret: str, *, unscoped: bool = False, trust_id: str | None = None, system_scope: str | None = None, domain_id: str | None = None, domain_name: str | None = None, project_id: str | None = None, project_name: str | None = None, project_domain_id: str | None = None, project_domain_name: str | None = None, reauthenticate: bool = True, include_catalog: bool = True)

继承自 Auth

__abstractmethods__ = frozenset({})
__annotations__ = {'MIN_TOKEN_LIFE_SECONDS': 'int', '_discovery_cache': 'dict[str, discover.Discover]', 'auth_ref': 'access.AccessInfo | None', 'auth_url': 'str', 'reauthenticate': 'bool'}
__doc__ = None
__init__(auth_url: str, consumer_key: str, consumer_secret: str, access_key: str, access_secret: str, *, unscoped: bool = False, trust_id: str | None = None, system_scope: str | None = None, domain_id: str | None = None, domain_name: str | None = None, project_id: str | None = None, project_name: str | None = None, project_domain_id: str | None = None, project_domain_name: str | None = None, reauthenticate: bool = True, include_catalog: bool = True) None
__module__ = 'keystoneauth1.extras.oauth1.v3'
_abc_impl = <_abc._abc_data object>
_auth_method_class

别名 OAuth1Method

class keystoneauth1.extras.oauth1.v3.OAuth1Method(*, access_key: str, access_secret: str, consumer_key: str, consumer_secret: str)

基类: AuthMethod

基于 OAuth 的身份验证方法。

参数:
  • access_key (字符串) – 访问令牌密钥。

  • access_secret (字符串) – 访问令牌密钥。

  • consumer_key (字符串) – 消费者密钥。

  • consumer_secret (字符串) – 消费者密钥。

__abstractmethods__ = frozenset({})
__annotations__ = {'_method_parameters': 'list[str] | None', 'access_key': <class 'str'>, 'access_secret': <class 'str'>, 'consumer_key': <class 'str'>, 'consumer_secret': <class 'str'>}
__doc__ = '基于OAuth的认证方法。\n\n    :param string access_key: 访问令牌密钥。\n    :param string access_secret: 访问令牌密钥。\n    :param string consumer_key: 消费者密钥。\n    :param string consumer_secret: 消费者密钥。\n    '
__init__(*, access_key: str, access_secret: str, consumer_key: str, consumer_secret: str) None
__module__ = 'keystoneauth1.extras.oauth1.v3'
_abc_impl = <_abc._abc_data object>
access_key: str
access_secret: str
consumer_key: str
consumer_secret: str
get_auth_data(session: Session, auth: Auth, headers: dict[str, str], request_kwargs: dict[str, object]) tuple[None, None] | tuple[str, Mapping[str, object]]

返回身份验证插件的身份验证部分。

参数:
  • session (keystoneauth1.session.Session) – 会话。

  • auth (base.Auth) – 调用该方法的认证插件。

  • headers (dict) – 将与身份验证请求一起发送的标头(如果插件需要添加标头)。

返回值:

此插件的标识符和用于身份验证类型的字典数据。

返回类型:

tuple(string, dict)

get_cache_id_elements() dict[str, str | None]

获取使该认证方法唯一化的元素。

这些元素将用作 keystoneauth1.plugin.BaseIdentityPlugin.get_cache_id() 的一部分,以允许缓存认证插件的状态。

如果希望允许缓存其状态,插件应重写此方法。

为避免冲突或覆盖,返回字典的键应以插件标识符为前缀。例如,密码插件将其用户名值作为“password_username”返回。