diff --git a/lib/application.js b/lib/application.js index d616e1c0..ed0733e0 100644 --- a/lib/application.js +++ b/lib/application.js @@ -305,7 +305,9 @@ app.enableAuth = function() { next(); } }); -} + + this.isAuthEnabled = true; +}; /** * Initialize an application from an options object or a set of JSON and JavaScript files. diff --git a/test/app.test.js b/test/app.test.js index eed3d7aa..701d22fe 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -400,6 +400,14 @@ describe('app', function() { }); }); + describe('enableAuth', function() { + it('should set app.isAuthEnabled to true', function() { + expect(app.isAuthEnabled).to.not.equal(true); + app.enableAuth(); + expect(app.isAuthEnabled).to.equal(true); + }); + }); + describe('app.get("/", loopback.status())', function () { it('should return the status of the application', function (done) { var app = loopback();