我想在流定义期间对选项中的acccessKey和secretKey进行编码是否在xd或集成中有相同的实用程序?我想在选项中对键进行编码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-aws="http://www.springframework.org/schema/integration/aws"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/aws http://www.springframework.org/schema/integration/aws/spring-integration-aws-1.0.xsd">
<int:poller fixed-delay="${fixedDelay}" default="true"/>
<bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials">
<property name="accessKey" value="${accessKey}"/>
<property name="secretKey" value="${secretKey}"/>
</bean>
<!-- aws-endpoint="https://s3.amazonaws.com" proxyHost="proxy.kdc.capitalone.com" proxyPort="8099"-->
<bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration">
<property name="proxyHost" value="${proxyHost}"/>
<property name="proxyPort" value="${proxyPort}"/>
<property name="preemptiveBasicProxyAuth" value="false"/>
</bean>
<bean id="s3Operations" class="org.springframework.integration.aws.s3.core.CustomC1AmazonS3Operations">
<constructor-arg index="0" ref="credentials"/>
<constructor-arg index="1" ref="clientConfiguration"/>
<property name="awsEndpoint" value="s3.amazonaws.com"/>
<property name="temporaryDirectory" value="${temporaryDirectory}"/>
<property name="awsSecurityKey" value="${awsSecurityKey}"/>
</bean>
<!-- aws-endpoint="https://s3.amazonaws.com" -->
<int-aws:s3-inbound-channel-adapter aws-endpoint="s3.amazonaws.com"
bucket="${bucket}"
s3-operations="s3Operations"
credentials-ref="credentials"
file-name-wildcard="${fileNameWildcard}"
remote-directory="${remoteDirectory}"
channel="splitChannel"
local-directory="${localDirectory}"
accept-sub-folders="false"
delete-source-files="true"
archive-bucket="${archiveBucket}"
archive-directory="${archiveDirectory}">
</int-aws:s3-inbound-channel-adapter>
<int-file:splitter input-channel="splitChannel" output-channel="output" markers="true">
</int-file:splitter>
<int:channel id="output"/>
流定义
module upload --file aws.jar --name aws-s3-options --type source
stream create feedTest29 --definition "aws-s3-options --accessKey=kkkk --secretKey=yyyy--temporaryDirectory=/tmp/output --awsSecurityKey=zzzz --bucket=test --fileNameWildcard=*.* --localDirectory=/tmp/MM/ | log" --deploy
答案 0 :(得分:2)
嗯,它不可能作为开箱即用的功能:https://jira.spring.io/browse/SPR-10666。
但是我会考虑像Spring Crypto Utils之类的东西用于这种任务。它可能看起来像:
<crypt:b64SymmetricCiphererWithStaticKey id="decrypter"
key="Rs3xEA16I52XJpsWwkw4GrB8l6FiVGK/"
initializationVector="AQIDBAUGAQI="
mode="DECRYPT"/>
当然,您可以选择任何其他方式来描述编码的密钥。
然后用法可能如下:
<property name="awsSecurityKey" value="#{decrypter.encrypt('${awsSecurityKey}')}"/>