Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#CHANGELOG

## v2.4.2

Issue [#48](https://github.com/qiniu/nodejs-sdk/pull/48):

- 去除 auth.GetPolicy.scope 的默认值:"*/*"

Issue [#46](https://github.com/qiniu/nodejs-sdk/pull/46):

- 更新 v2.4.1 的文档(docs/README.md)


## v2.4.1

2013-02-09
Expand Down
8 changes: 5 additions & 3 deletions lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ function PutPolicy(opts) {

PutPolicy.prototype.token = function() {
var params = {
"deadline": this.expires + Math.floor(Date.now() / 1000),
"escape": this.excape,
"deadline": this.expires + Math.floor(Date.now() / 1000)
};
if (this.scope !== null) {
params["scope"] = this.scope;
Expand All @@ -65,6 +64,9 @@ PutPolicy.prototype.token = function() {
if (this.asyncOps !== null) {
params["asyncOps"] = this.asyncOps;
}
if (this.escape) {
params["escape"] = this.excape;
}
return generateToken(params);
};

Expand All @@ -73,7 +75,7 @@ PutPolicy.prototype.token = function() {

function GetPolicy(opts) {
this.expires = opts.expires || 3600;
this.scope = opts.scope || "*/*";
this.scope = opts.scope; // GetPolicy.scope 没有默认值:用 "*/*" 访问权限太高!
}

GetPolicy.prototype.token = function() {
Expand Down