-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API 网关:采用认证信息标准化方案调用 API #325
Comments
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 7, 2023
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 7, 2023
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 7, 2023
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 8, 2023
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 8, 2023
wcy00000000000000
added a commit
to wcy00000000000000/bk-cmdb
that referenced
this issue
Nov 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
背景
蓝鲸认证信息,是用于标识蓝鲸应用和用户的数据;调用者访问接入蓝鲸 API 网关的云 API 接口时,如果云 API 接口需要认证应用或用户,则请求时需要携带这些认证信息,才能正常发起请求。
目前,API 网关支持 2 种传递认证信息的方案:
X-Bkapi-Authorization
中 (推荐
)采用方案一时,API 网关需要处理额外的任务,包括解析 querystring 和多种格式的 body(如 json、x-www-form-urlencoded、form-data 等)来获取认证信息,以及在向后端转发请求时,删除请求参数中的敏感数据(如 bk_app_secret、bk_token 等)。这存在以下问题:
因此,推荐采用第二种方案进行认证信息的传递。目前正在使用第一种方案的调用者,也需要切换至第二种方案,并且去除请求参数中的蓝鲸认证信息(迁移方案参考下文)。
认证信息标准化方案
认证信息的标准化方案,即上文提到的第二个方案,可通过请求头
X-Bkapi-Authorization
传递认证信息,值为 JSON 格式字符串。**注意:**二进制版本 open-paas/esb >= 2.12.20 支持 X-Bkapi-Authorization,应用调整时,需关注
示例: 使用 curl 命令,请求时携带认证请求头
示例: 使用 Python 语言和 requests 模块
X-Bkapi-Authorization
请求头所支持的全部字段如下表所示:蓝鲸开发者中心 -> 应用基本设置 -> 基本信息 -> 鉴权信息
获取;网关 SDK 默认已添加蓝鲸开发者中心 -> 应用基本设置 -> 基本信息 -> 鉴权信息
获取;网关 SDK 默认已添加注意:
如何迁移到标准化认证信息方案
直接调用
使用蓝鲸网关SDK/组件 SDK
注意:
版本依赖
概念 & FAQ
请参考:#74
The text was updated successfully, but these errors were encountered: