keystoneauth1.identity.v3.oauth2_client_credential 模块

异常 keystoneauth1.identity.v3.oauth2_client_credential.ClientException(message: str | None = None)

基类: Exception

与客户端相关的所有内容的基类异常。

__annotations__ = {}
__doc__ = '与客户端相关的所有内容的基类异常。'
__init__(message: str | None = None)
__module__ = 'keystoneauth1.exceptions.base'
__weakref__

对该对象的弱引用列表

message = 'ClientException'
keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredential(auth_url: str, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str, *, 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

通过 OAuth2.0 客户端凭据进行身份验证的插件。

参数:
  • auth_url (string) – 身份服务端点,用于身份验证。

  • oauth2_endpoint (string) – OAuth2.0 端点。

  • oauth2_client_id (string) – OAuth2.0 客户端凭据 ID。

  • oauth2_client_secret (字符串) – OAuth2.0 客户端凭据密钥。

__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__ = '通过 OAuth2.0 客户端凭据进行身份验证的插件。\n\n    :param 字符串 auth_url: 身份验证的身份服务端点。\n    :param 字符串 oauth2_endpoint: OAuth2.0 端点。\n    :param 字符串 oauth2_client_id: OAuth2.0 客户端凭据 ID。\n    :param 字符串 oauth2_client_secret: OAuth2.0 客户端凭据密钥。\n    '
__init__(auth_url: str, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str, *, 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.identity.v3.oauth2_client_credential'
_abc_impl = <_abc._abc_data object>
_auth_method_class

别名 OAuth2ClientCredentialMethod

_discovery_cache: dict[str, discover.Discover]
auth_ref: access.AccessInfo | None
auth_url: str
get_headers(session: Session) dict[str, str] | None

获取消息的身份验证头。

参数:

session (keystoneauth1.session.Session) – 该认证插件所属的会话对象。

返回值:

用于验证消息的头,或者失败的 None。请注意,空字典是一个有效的、非失败的响应。

返回类型:

dict

reauthenticate: bool
keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredentialMethod(*, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str)

基类: AuthMethod

一种通过 OAuth2.0 客户端凭据获取令牌的身份验证方法。

参数:
  • oauth2_endpoint (string) – OAuth2.0 端点。

  • oauth2_client_id (string) – OAuth2.0 客户端凭据 ID。

  • oauth2_client_secret (字符串) – OAuth2.0 客户端凭据密钥。

__abstractmethods__ = frozenset({})
__annotations__ = {'_method_parameters': 'list[str] | None', 'oauth2_client_id': <class 'str'>, 'oauth2_client_secret': <class 'str'>, 'oauth2_endpoint': <class 'str'>}
__doc__ = '一种 通过 OAuth2.0 客户端凭据获取令牌的身份验证方法。\n\n    :param string oauth2_endpoint: OAuth2.0 端点。\n    :param string oauth2_client_id: OAuth2.0 客户端凭据 ID。\n    :param string oauth2_client_secret: OAuth2.0 客户端凭据密钥。\n    '
__init__(*, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str) None
__module__ = 'keystoneauth1.identity.v3.oauth2_client_credential'
_abc_impl = <_abc._abc_data object>
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”返回。

oauth2_client_id: str
oauth2_client_secret: str
oauth2_endpoint: str