UploaderStrategy still requires api_secret if parameter was already added externally

未关闭
#125 4 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@yakirp 已经在做这个了。

开始于 2018年5月7日。

评估

这个 Issue 还没有评估数据。

描述

enhancement

This issue affects all current http artifacts:
https://github.com/cloudinary/cloudinary_java/blob/090788607f1b92f895b7b79c67e1e628719666c6/cloudinary-http42/src/main/java/com/cloudinary/http42/UploaderStrategy.java#L45-L49

Compared to the implementation on cloudinary-android:

if (requiresSigning(action, options)) {
    String apiKey = ObjectUtils.asString(options.get("api_key"), this.cloudinary().config.apiKey);
    if (apiKey == null)
        throw new IllegalArgumentException("Must supply api_key");
    if (options.containsKey("signature") && options.containsKey("timestamp")) {
        params.put("timestamp", options.get("timestamp"));
        params.put("signature", options.get("signature"));
        params.put("api_key", apiKey);
    } else {
        String apiSecret = ObjectUtils.asString(options.get("api_secret"), this.cloudinary().config.apiSecret);
        if (apiSecret == null)
            throw new IllegalArgumentException("Must supply api_secret");
        params.put("timestamp", Long.valueOf(System.currentTimeMillis() / 1000L).toString());
        params.put("signature", this.cloudinary().apiSignRequest(params, apiSecret));
        params.put("api_key", apiKey);
    }
}

Cloudinary Android Source: https://github.com/cloudinary/cloudinary_android/blob/f7a0b32cfd9f2b6507bb6461043e6c89d9478c03/lib/src/main/java/com/cloudinary/android/UploaderStrategy.java#L43-L59

My suggestion is to implement that for each http artifact or simply refactor the android implementation upwards to the core AbstractUploaderStrategy.

This allows cloudinary-java users to not have to enter api_secret if say the signature is generated via other microservices/authorization servers. This also allows easier server-side integration tests.

While I understand the audience for cloudinary-java is more towards server users where the secret key is most likely exposed within a monolithic service, the two reasons above are currently forcing us to mangle a separate UploaderStrategy which simply use the above Android part instead.

主要语言
Java
星标
176
派生
113
平均合并
9 天 20 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudinary/cloudinary_java 的其他 Issue

查看 cloudinary/cloudinary_java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。