自定义策略不会保留属性数组上的先前数值。

huangapple go评论55阅读模式
英文:

Custom policy does not maintain previous values on properties array

问题

我正在按照这个文档创建自定义策略。

我创建了一个策略,它正常工作。策略的 JSON 模式如下所示:

{
    "title": "ACME Custom Basic Auth Policy",
    "description": "基本认证策略,根据自定义消费者凭据强制执行安全性",
    "type": "object",
    "properties": {
        "users": {
            "title": "用户",
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "username",
                    "password"
                ],
                "properties": {
                    "username": {
                        "title": "用户名",
                        "type": "string",
                        "default": []
                    },
                    "password": {
                        "title": "用户密码",
                        "type": "string",
                        "@context": {
                            "@characteristics": [
                                "security:sensitive"
                            ]
                        }
                    }
                }
            },
            "minItems": 1
        }
    },
    "@context": {
        "@vocab": "anypoint://vocabulary/policy.yaml#",
        "security": "anypoint://vocabulary/policy.yaml#"
    },
    "$id": "allow-dynamic-resources",
    "$schema": "https://json-schema.org/draft/2019-09/schema"
}

当我进入 API 管理器时,我可以在第一次尝试中配置这些值,但当我回去更改这些值时,它们不会出现。

这仅在我配置一个数组时发生。如果我将其配置为对象,它可以正常工作。我应该如何修复这个问题?

英文:

I am creating a custom policy following this documentation.

I created one, and it is working. The JSON schema for the policy is shown below:

{
	"title": "ACME Custom Basic Auth Policy",
	"description": "Basic Authentication policy which enforces security according with custom consumer credentials",
	"type": "object",
	"properties": {
		"users": {
			"title": "users",
			"type": "array",
			"items": {
				"type": "object",
				"required": [
					"username",
					"password"
				],
				"properties": {
					"username": {
						"title": "User Name",
						"type": "string",
						"default": []
					},
					"password": {
						"title": "User Password",
						"type": "string",
						"@context": {
							"@characteristics": [
								"security:sensitive"
							]
						}
					}
				}
			},
			"minItems": 1
		}
	},
	"@context": {
		"@vocab": "anypoint://vocabulary/policy.yaml#",
		"security": "anypoint://vocabulary/policy.yaml#"
	},
	"$id": "allow-dynamic-resources",
	"$schema": "https://json-schema.org/draft/2019-09/schema"
}

When I go to API Manager, I can configure the values on first attempt, but when I go back to change the values, they do not appear.

自定义策略不会保留属性数组上的先前数值。

This happens only when I configure an array. If I configure as an object, it works. How can I fix this?

自定义策略不会保留属性数组上的先前数值。

答案1

得分: 0

他们解释当一个字段被声明为:

"characteristics": [
    "security:sensitive"
]

在重新编辑策略时,不会提示值。

英文:

I opened a support ticket for MuleSoft and they explained when a field is declared with

"@characteristics": [
    "security:sensitive"
]

the values are not prompted when reediting policy.

huangapple
  • 本文由 发表于 2023年2月9日 00:56:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75389155.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定