diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..fa8463b --- /dev/null +++ b/build.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java index 87beb64..8bb23c4 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java @@ -1,8 +1,8 @@ package com.fanruan.fs.s3.repository.core; +import com.fanruan.api.conf.HolderKit; import com.fr.config.Identifier; import com.fr.config.holder.Conf; -import com.fr.config.holder.factory.Holders; import com.fr.io.config.CommonRepoConfig; import com.fr.io.context.ResourceModuleContext; import com.fr.io.context.info.GetConfig; @@ -21,19 +21,16 @@ public class S3Config extends CommonRepoConfig { } @Identifier("endPoint") - private Conf endPoint = Holders.simple(StringUtils.EMPTY); + private Conf endPoint = HolderKit.simple(StringUtils.EMPTY); @Identifier("region") - private Conf region = Holders.simple(StringUtils.EMPTY); + private Conf region = HolderKit.simple(StringUtils.EMPTY); @Identifier("accessKeyId") - private Conf accessKeyId = Holders.simple(StringUtils.EMPTY); - - @Identifier("accessKeySecret") - private Conf accessKeySecret = Holders.simple(StringUtils.EMPTY); + private Conf accessKeyId = HolderKit.simple(StringUtils.EMPTY); @Identifier("bucket") - private Conf bucket = Holders.simple(StringUtils.EMPTY); + private Conf bucket = HolderKit.simple(StringUtils.EMPTY); @GetConfig("endPoint") public String getEndPoint() { @@ -65,16 +62,6 @@ public class S3Config extends CommonRepoConfig { this.accessKeyId.set(accessKeyId); } - @GetConfig("accessKeySecret") - public String getAccessKeySecret() { - return accessKeySecret.get(); - } - - @SetConfig("accessKeySecret") - public void setAccessKeySecret(String accessKeySecret) { - this.accessKeySecret.set(accessKeySecret); - } - @GetConfig("bucket") public String getBucket() { return bucket.get(); @@ -93,7 +80,6 @@ public class S3Config extends CommonRepoConfig { this.setEndPoint(newConfig.getEndPoint()); this.setRegion(newConfig.getRegion()); this.setAccessKeyId(newConfig.getAccessKeyId()); - this.setAccessKeySecret(newConfig.getAccessKeySecret()); this.setBucket(newConfig.getBucket()); } } @@ -104,7 +90,6 @@ public class S3Config extends CommonRepoConfig { cloned.endPoint = (Conf) endPoint.clone(); cloned.region = (Conf) region.clone(); cloned.accessKeyId = (Conf) accessKeyId.clone(); - cloned.accessKeySecret = (Conf) accessKeySecret.clone(); cloned.bucket = (Conf) bucket.clone(); return cloned; } diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java index 90e6600..c10815a 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java @@ -36,7 +36,7 @@ public class S3RepositoryFactory extends ConfigRepositoryFactory { @Override public boolean verifyConfig(S3Config config) { try { - BasicAWSCredentials credentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getAccessKeySecret()); + BasicAWSCredentials credentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getPassword()); AmazonS3 s3 = AmazonS3ClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(config.getEndPoint(), config.getRegion())) .withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java index 5ab689b..73eb62d 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java @@ -43,7 +43,7 @@ public class S3ResourceRepository extends BaseResourceRepository { public S3ResourceRepository(String repoName, String workRoot, S3Config config) { super(repoName, workRoot); - BasicAWSCredentials credentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getAccessKeySecret()); + BasicAWSCredentials credentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getPassword()); this.s3 = AmazonS3ClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(config.getEndPoint(), config.getRegion())) .withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); diff --git a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js index 87412ec..ed0acc6 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js +++ b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js @@ -91,21 +91,18 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { }] }, { - type: "dec.label.editor.item", + type: "dec.common.cipher.editor", textWidth: LABEL_WIDTH, editorWidth: EDITOR_WIDTH, watermark: BI.i18nText("Plugin-S3_Access_Key_Secret"), text: BI.i18nText("Plugin-S3_Access_Key_Secret"), - value: "******", + value: this.model.password, el: { disabled: !o.editable, }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: function () { - self.store.setAccessKeySecret(this.getValue()); - } - }] + ref: function (_ref) { + self.passwordRow = _ref; + } }, { type: "dec.label.editor.item", @@ -132,7 +129,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { endPoint: this.model.endPoint, region: this.model.region, accessKeyId: this.model.accessKeyId, - accessKeySecret: this.model.accessKeySecret, + password: this.passwordRow.getCipher(), bucket: this.model.bucket }; }, @@ -151,7 +148,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { endPoint: val.endPoint, region: val.region, accessKeyId: val.accessKeyId, - accessKeySecret: val.accessKeySecret, + password: val.password, bucket: val.bucket }; }, @@ -179,9 +176,6 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { this.model.accessKeyId = v; }, - setAccessKeySecret: function (v) { - this.model.accessKeySecret = v; - }, setBucket: function (v) { this.model.bucket = v; }