Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Commit

Permalink
Merge pull request #9 from firebase/NaNaNaNaNa
Browse files Browse the repository at this point in the history
Fixed issue which allows NaN to be passed to exp and iat
  • Loading branch information
mikelehen committed Aug 7, 2014
2 parents 985d055 + 13f079d commit 1fddca4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-token-generator",
"version": "1.1.2",
"version": "1.1.3",
"homepage": "https://firebase.com",
"authors": [
"Firebase <[email protected]>"
Expand Down
16 changes: 8 additions & 8 deletions build/firebase-token-generator-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,8 +999,8 @@ fb.tokengenerator.validation.validateCredentialOptions = function(fnName, argume
}
};
fb.tokengenerator.validation.validateOption = function(prefix, optName, opt, expectedType, suffix) {
if(typeof opt !== expectedType) {
throw new Error(prefix + " option " + optName + " must be " + suffix);
if(typeof opt !== expectedType || expectedType === "number" && isNaN(opt)) {
throw new Error(prefix + ' option "' + optName + '" must be ' + suffix + ", instead got " + opt);
}
};
goog.provide("goog.dom.NodeType");
Expand Down Expand Up @@ -2450,28 +2450,28 @@ FirebaseTokenGenerator.prototype.createOptionsClaims = function(func_name, opts)
if(opts[o] instanceof Date) {
claims[code] = Math.round(opts[o].getTime() / 1E3)
}else {
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "number", "a number.");
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "number", "a number");
claims[code] = opts[o]
}
break;
case "admin":
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean.");
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean");
claims["admin"] = opts[o];
break;
case "debug":
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean.");
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean");
claims["debug"] = opts[o];
break;
case "simulate":
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean.");
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "boolean", "a boolean");
claims["simulate"] = opts[o];
break;
case "iat":
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "number", "a number.");
fb.tokengenerator.validation.validateOption(func_name, o, opts[o], "number", "a number");
claims["iat"] = opts[o];
break;
default:
throw new Error(func_name + " unrecognized option: " + o);
throw new Error(func_name + ': unrecognized "' + o + '" option');
}
}
return claims
Expand Down
6 changes: 3 additions & 3 deletions build/firebase-token-generator-node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions build/firebase-token-generator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1fddca4

Please sign in to comment.