Skip to content
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

Support tenant/application level AK/SK #75

Open
gudaoxuri opened this issue Dec 1, 2022 · 0 comments
Open

Support tenant/application level AK/SK #75

gudaoxuri opened this issue Dec 1, 2022 · 0 comments

Comments

@gudaoxuri
Copy link
Contributor

实现针对租户/应用的AK/SK授权与鉴权机制,并提供对OAuth2的部分支持,实现AccessToken的授权范围处理。

场景描述:

  • 开放平台下提供应用或租户的AK、SK,实现通过OpenAPI访问相关能力
  • 文件分享、Webhook等功能需要对发放的URL提供一定的权限限制

AK/SK实现逻辑:

  1. IAM: 添加 ci 类型的API,用于处理服务端接口调用
  2. IAM: 添加 IamCertKernelKind::AkSk 类型并实现 cert_conf cert 的配置
  3. 网关: 添加对 ak/sk 类型的验签

AccessToken实现逻辑:

  1. IAM: ci 接口支持通过创建当前 AKAccessTokenRefresh Tokens 并能指定生效时间及授权范围(Scope)(OAuth2 Client-credentials模式: https://oauth.net/2/grant-types/client-credentials/
  2. IAM: AccessTokenRefresh Tokens 生效时间写入 cert 表,绑定到 AK/SK对应的 cert
  3. IAM: 建立一个名为 OAuth 的内置 Set , 把资源(授权API)绑定到该 SetCate 下(Via: RbumRelFromKind::SetCate, To 资源API)并同步到缓存(对应于add_or_modify_res_rel,add_or_modify_req参数中的groups)
  4. IAM: 授权范围(Scope) 对应 OAuth Set的一个或多个 SetCate (Via: RbumRelFromKind::SetCate To ?)TODO
  5. IAM: AccessToken 及授权范围写入到 iam:cache:token:info:xxx 缓存,值修改为: token_kind, rel_iam_item_id, ak, SetCateIds
  6. 网关: 修改Token处理的逻辑,如果 Header AuthorizationBearer 开头也作为Token处理,获取rel_iam_item_id的同时也获取到ak, SetCateIds,如果存在ak则忽略 iam:cache:account:info:xx 直接生成 ctx.ident_info , iam_groups=SetCateIds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant