Skip to content

Commit 6ef730c

Browse files
committed
feat: 支持蓝鲸插件框架添加网关鉴权 --story=129089299
1 parent bcbe891 commit 6ef730c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/data/api-definition.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,13 @@ stage:
2323
max_age: 86400
2424
allow_credential: true
2525
26+
{% if settings.BK_APIGW_GRANTED_APPS %}
27+
grant_permissions:
28+
{% for app_code in settings.BK_APIGW_GRANTED_APPS %}
29+
- bk_app_code: {{ app_code }}
30+
grant_dimension: "gateway"
31+
{% endfor %}
32+
{% endif %}
33+
2634
release:
2735
comment: "auto release by bk-plugin-runtime"

bk-plugin-framework/bk_plugin_framework/services/bpf_service/management/commands/sync_plugin_apigw.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def handle(self, *args, **kwargs):
2727
call_command("sync_apigw_resources", file=resources_file_path)
2828
print("[bk-plugin-framework]call sync_apigw_strategies with definition: %s" % definition_file_path)
2929
call_command("sync_apigw_strategies", file=definition_file_path)
30+
print("[bk-plugin-framework]call grant_apigw_permissions with definition: %s" % definition_file_path)
31+
call_command("grant_apigw_permissions", file=definition_file_path)
3032

3133
# if getattr(settings, "BK_APIGW_CORS_ALLOW_ORIGINS"):
3234
# strategy_cors_file_path = os.path.join(__file__.rsplit("/", 1)[0], "data/api-strategy-cors.yml")

runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,4 @@ def logging_addition_settings(logging_dict):
253253
BK_APIGW_CORS_ALLOW_METHODS = os.getenv("BK_APIGW_CORS_ALLOW_METHODS", "")
254254
BK_APIGW_CORS_ALLOW_HEADERS = os.getenv("BK_APIGW_CORS_ALLOW_HEADERS", "")
255255
BK_APIGW_DEFAULT_TIMEOUT = int(os.getenv("BK_APIGW_DEFAULT_TIMEOUT", "60"))
256+
BK_APIGW_GRANTED_APPS = [BK_APP_CODE] + [each.strip() for each in os.getenv("BK_APIGW_GRANTED_APPS", "").split(",") if each.strip()]

0 commit comments

Comments
 (0)