Mule 4安全属性占位符不起作用

时间:2019-05-27 15:34:22

标签: security anypoint-studio mulesoft property-placeholder mule4

这是我的配置,其中我定义了我的属性文件,即dev.properties,其中包含一些加密值。我已经定义了我的安全财产占位符,但是它不起作用

<global-property doc:name="Global Property" doc:id="7080a89f-d39c-485d-99c4-b35337ab62c4" name="env" value="dev" />
    <global-property doc:name="Global Property" doc:id="5d1fb026-a34f-490f-9b50-7a9bcb5cdf83" name="enc.key" value="password" />
    <configuration-properties doc:name="Configuration properties"
        doc:id="7448fcf9-e3ef-41b4-879e-9551ab99aa29" file="properties/${env}.properties" />
        <secure-properties:config name="Secure_Properties_Config" doc:name="Secure Properties Config" doc:id="0bbad3ed-42bb-4e13-bc88-e9c1fc6d21f4" file="properties/${env}.properties" key="${enc.key}"  >
    </secure-properties:config>

我已使用AES算法使用值密码进行了加密。但是,它无法使用提供的配置解密这些值。

1 个答案:

答案 0 :(得分:1)

首先,您使用delete加载相同的属性文件,然后再次使用<form action="#"> <div class="form-group"> <label for="title">Title</label> <input type="text" name="title" class="form-control" id="title" placeholder="Enter title"> </div> <div class="form-group"> <label for="body">Body</label> <textarea class="form-control" name="body" id="body" rows="10"></textarea> </div> <button type="submit" class="btn btn-primary">Update</button> <form action="#"> <button type="submit" class="btn btn-danger">DELETE</button> </form> </form> 加载属性文件。如果文件包含configuration-properties,则仅使用s secure-properties加载一次。

第二,您需要使用ecure-properties语法来读取安全属性,而不仅仅是secure-properties

如果您将同一文件用于安全和非安全属性,则仍必须对非安全属性使用${secure:myProp.someProp}

因此,最佳实践是将属性文件分为${myProp.someProp}(对于非安全属性)和${secure:myProp.someProp}(对于安全属性)。然后,您可以将配置属性$ {env} .properties和安全属性用于${env}.properties

如果遇到特定错误,请详细更新问题。