Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义返回获取token时forceSaveKey参数不生效 #469

Open
guanghuishan opened this issue Jan 9, 2020 · 2 comments
Open

自定义返回获取token时forceSaveKey参数不生效 #469

guanghuishan opened this issue Jan 9, 2020 · 2 comments
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.

Comments

@guanghuishan
Copy link

自定义返回获取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);
}
}
});
}

@guanghuishan guanghuishan changed the title policyFields 遗漏字段 自定义返回获取token时forceSaveKey参数不生效 Jan 9, 2020
@forrest-mao
Copy link

forrest-mao commented Jul 21, 2020

uploadToken 方法中最后一个参数设置为 false 在试下,设置为 true 的情况下 forceSaveKey 设置会不成功

public String uploadToken(String bucket, String key, long expires, StringMap policy) {
           return uploadToken(bucket, key, expires, policy, false); // 这里的 uploadToken 方法中最后一个参数设置为 false 可以再试下
}

@forrest-mao forrest-mao added 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. labels Jul 21, 2020
@aboutZZ
Copy link

aboutZZ commented Oct 20, 2021

uploadToken 方法中最后一个参数设置为 false 在试下,设置为 true 的情况下 forceSaveKey 设置会不成功

public String uploadToken(String bucket, String key, long expires, StringMap policy) {
           return uploadToken(bucket, key, expires, policy, false); // 这里的 uploadToken 方法中最后一个参数设置为 false 可以再试下
}

你好forceSaveKey是合法的policy,最好还是加入为好,而不是通过设置strictfalse
相关代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants