2.2. 凭证
user_key
、app_key
和 client_secret
字段有最大长度和保留字符的限制:
只能使用字母数字字符 [0-9, a-z, A-Z], 分号-减号 (-), 5 到 256 个字符。不允许使用空格。
此外,app_id
和 client_id
的最大长度为 140 个字符。
3scale 中的 API 凭证是 user_key
或 app_id/app_key
,具体取决于您使用的身份验证模式。OpenID Connect 对暂存环境中的 API 网关有效,但它无法在 Integration 页面中进行测试。
但是,您可能想要在 API 中使用不同的凭证名称。在这种情况下,如果使用 API 密钥模式,您需要为 user_key
设置自定义名称:
![自定义 user_key](https://access.redhat.com/webassets/avalon/d/Red_Hat_3scale_API_Management-2.14-Administering_the_API_Gateway-zh-CN/images/2323c197c2060ee9fda8cd8c1e8f09bd/deployment-options-custom-auth-user-key.png)
另外,对于 app_id
和 app_key
:
![自定义 app_key/app_id](https://access.redhat.com/webassets/avalon/d/Red_Hat_3scale_API_Management-2.14-Administering_the_API_Gateway-zh-CN/images/d97d8f6cae428c0db7e8e82277726058/deployment-options-custom-auth-app-id-app-key.png)
例如,如果这更适合您的 API,您可以将 app_id
重命名为 key
。网关将使用名称 key
,并将其转换为 app_id
,然后向 3scale 后端执行授权调用。请注意,新凭证名称必须是字母数字。
您可以决定您的 API 是否以 HTTP Basic Auth 格式传递凭证,或者作为查询参数(GET)或正文参数(POST/PUT/DELETE)。
![代理凭证位置](https://access.redhat.com/webassets/avalon/d/Red_Hat_3scale_API_Management-2.14-Administering_the_API_Gateway-zh-CN/images/4bd1bd286704bf574eff927a4fa86540/deployment-options-proxy-credentials-location.png)
APIcast 在提取凭据时规范化标头名称。这意味着它们不区分大小写,下划线和连字符可以平等对待。例如,如果您将 App Key 参数设置为 App_Key
,其他值(如 app-key)
也被接受,作为有效的 app 键标头。