自定义返回获取token时forceSaveKey参数不生效 #469
Labels
no-action-needed
The issue is either fixed, addressed better by other issues, or just out of product scope.
waiting-for-info
Issue is not actionable because of missing required information, which needs to be provided.
自定义返回获取token时使用函数Auth.uploadToken时forceSaveKey参数不生效
public String uploadToken(String bucket, String key, long expires, StringMap policy) {
return uploadToken(bucket, key, expires, policy, true);
}
因为最终调用的函数copyPolicy会过滤掉部分参数,forceSaveKey就回不生效。字段「白名单」policyFields并不包含该参数
private static void copyPolicy(final StringMap policy, StringMap originPolicy, final boolean strict) {
if (originPolicy == null) {
return;
}
originPolicy.forEach(new StringMap.Consumer() {
@OverRide
public void accept(String key, Object value) {
if (StringUtils.inStringArray(key, deprecatedPolicyFields)) {
throw new IllegalArgumentException(key + " is deprecated!");
}
if (!strict || StringUtils.inStringArray(key, policyFields)) {
policy.put(key, value);
}
}
});
}
The text was updated successfully, but these errors were encountered: