REST Resource: projects.locations.authorizations

资源:授权

Discovery Engine 授权资源。

JSON 表示法
{
  "name": string,
  "displayName": string,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "serverSideOauth2": {
    object (ServerSideOAuth2)
  }
  // End of mutually exclusive fields.
}
字段
name

string

标识符。授权的资源名称。格式:projects/{project}/locations/{location}/authorizations/{authorization}

此字段必须是采用 UTF-8 编码的字符串,长度限制为 1024 个字符。

displayName

string

必需。授权的显示名称。

此字段必须是采用 UTF-8 编码的字符串,长度限制为 128 个字符。

授权配置。以下是互斥字段的列表。在响应中,最多只能设置以下字段之一:
serverSideOauth2

object (ServerSideOAuth2)

服务器端 OAuth2 配置。

互斥字段的结束。

ServerSideOAuth2

OAuth2 配置。

JSON 表示法
{
  "clientId": string,
  "clientSecret": string,
  "tokenUri": string,
  "authorizationUri": string,
  "scopes": [
    string
  ],
  "pkceVerificationEnabled": boolean,
  "basicAuthenticationEnabled": boolean,
  "privateNetworkConfig": {
    object (PrivateNetworkConfig)
  }
}
字段
clientId

string

必需。OAuth2 客户端 ID。

clientSecret

string

必需。OAuth2 客户端密钥。

已静态加密。

tokenUri

string

必需。将客户端授权交换为访问令牌的 HTTP 端点。

authorizationUri

string

必需。当用户需要授权时,用户将定向到的 URI。应包含成功授权所需的一切信息:OAuth ID、额外标志等。示例:https://accounts.google.com/o/oauth2/v2/auth?clientId=OAUTH_ID&scope=https://www.googleapis.com/auth/calendar.events&responseType=code&access_type=offline&prompt=consent

redirectUri 参数将被 Vertex AI Search 前端覆盖。

scopes[]

string

可选。要请求的范围。示例:https://www.googleapis.com/auth/calendar.events 如果省略,则不会请求授权 URI 所需范围以外的其他范围。如果设置,则在获取用户授权时,它会覆盖授权 URI 中的范围。

pkceVerificationEnabled

boolean

可选。是否启用 PKCE 验证。https://datatracker.ietf.org/doc/html/rfc7636#section-3.1/

basicAuthenticationEnabled

boolean

可选。OAuth 令牌交换是否使用 HTTP 基本身份验证 (client_secret_basic) 而不是在请求正文 (client_secret_post) 中发送客户端凭据。如果为 true,则凭据 (clientId:clientSecret) 会进行 Base64 编码,并在 Authorization 标头中发送。某些 OAuth 提供方(例如 Splunk)需要 client_secret_basic。如果值为 false 或未设置,则使用默认值 client_secret_post。

privateNetworkConfig

object (PrivateNetworkConfig)

可选。仅当 OAuth 提供方未发布任何公共端点时设置,在这种情况下,令牌交换必须通过实例所在的专用网络进行路由,而不是通过公共出站流量进行路由。如果未设置,则交换将保持在公共出站流量上。

PrivateNetworkConfig

用于标识仅可通过专用网络访问的 OAuth 提供方所托管的实例。

JSON 表示法
{
  "instanceResource": string
}
字段
instanceResource

string

必需。托管 OAuth 提供方的实例的资源名称。对于 Looker,Looker 实例,格式为 projects/{project}/locations/{location}/instances/{instance}。

方法

acquireUserAuthorization

使用通过最终用户凭证和给定资源标识的用户的存储刷新令牌,并返回生成的访问令牌及其详细信息。

create

创建一个 Authorization。

delete

删除一个 Authorization。

get

获取一个 Authorization。

list

列出某个 Engine 下的所有 Authorization。

patch

更新一个 Authorization

storeUserAuthorization

将 OAuth 授权凭证交换为刷新令牌,并存储该刷新令牌和范围。