Add allowAnyoneAuthorizer in JS.
MultiPart: 1/2
Change-Id: I3f01f39e8ffd0961c1be3399e476a3938fd1be05
diff --git a/src/security/access/allow-everyone-authorizer.js b/src/security/access/allow-everyone-authorizer.js
new file mode 100644
index 0000000..39ee483
--- /dev/null
+++ b/src/security/access/allow-everyone-authorizer.js
@@ -0,0 +1,27 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+/**
+ * @fileoverview The Allow Everyone authorizer
+ * @private
+ */
+
+module.exports = authorizer;
+
+/**
+ * @function
+ * @name allowEveryoneAuthorizer
+ * @summary The allowEveryoneAuthorizer is an authorizer that allows access to
+ * every user, regardless of their blessings.
+ * @description WARNING: This authorizer provides NO security whatsoever. It
+ * should be used only in tests or during development, or in applications that
+ * do not require any authorization.
+ * @memberof module:vanadium.security.access
+ * @return {module:vanadium.security.Authorize} An authorizer which allows
+ * everybody.
+ */
+function authorizer() {
+ return function authorize(ctx, call) {
+ return;
+ };
+}
diff --git a/src/security/access/index.js b/src/security/access/index.js
index 33d2e4a..6964eb8 100644
--- a/src/security/access/index.js
+++ b/src/security/access/index.js
@@ -90,5 +90,6 @@
*/
/* jshint ignore:end */
module.exports = extend(require('../../gen-vdl/v.io/v23/security/access'), {
+ allowEveryoneAuthorizer: require('./allow-everyone-authorizer'),
permissionsAuthorizer: require('./permissions-authorizer')
});
diff --git a/test/integration/test-authorizer.js b/test/integration/test-authorizer.js
index 08902b9..ef9da8e 100644
--- a/test/integration/test-authorizer.js
+++ b/test/integration/test-authorizer.js
@@ -7,6 +7,8 @@
var Deferred = require('../../src/lib/deferred');
var permissionsAuthorizer =
require('../../src/security/access/permissions-authorizer');
+var allowEveryoneAuthorizer =
+ require('../../src/security/access/allow-everyone-authorizer');
var serve = require('./serve');
@@ -204,8 +206,6 @@
testSuccessCase(assert, diffPublicKeyPermsAuthorizer, [tagFoo], true);
});
-
-
test('Test permissionsAuthorizer (tag) - failure', function(assert) {
var tagBar = new access.Tag('Bar');
@@ -218,3 +218,7 @@
// Nobody is allowed via the Bar tag.
testErrorCase(assert, diffPublicKeyPermsAuthorizer, [tagBar], true);
});
+
+test('Test allowEveryoneAuthorizer() - success', function(assert) {
+ testSuccessCase(assert, allowEveryoneAuthorizer(), [], true);
+});