mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'dev' into diagnostics
This commit is contained in:
@@ -92,7 +92,23 @@ describe("api/auth/strategies", function() {
|
||||
tokenCreate.restore();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Uses provided token on authentication success and token provided',function(done) {
|
||||
userAuthentication = sinon.stub(Users,"authenticate").callsFake(function(username,password) {
|
||||
return Promise.resolve({username:"user",permissions:"*",token:"123456"});
|
||||
});
|
||||
|
||||
strategies.passwordTokenExchange({id:"myclient"},"user","password","read",function(err,token) {
|
||||
try {
|
||||
should.not.exist(err);
|
||||
token.should.equal("123456");
|
||||
done();
|
||||
} catch(e) {
|
||||
done(e);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -379,7 +379,6 @@ describe('red/runtime/nodes/credentials', function() {
|
||||
credentials.export().then(function(result) {
|
||||
result.should.have.a.property("$");
|
||||
settings.should.not.have.a.property("_credentialSecret");
|
||||
|
||||
// reset everything - but with _credentialSecret still set
|
||||
credentials.init(runtime);
|
||||
// load the freshly encrypted version
|
||||
@@ -445,6 +444,21 @@ describe('red/runtime/nodes/credentials', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('handles bad credentials object - resets credentials', function(done) {
|
||||
settings = {
|
||||
credentialSecret: "e3a36f47f005bf2aaa51ce3fc6fcaafd79da8d03f2b1a9281f8fb0a285e6255a"
|
||||
};
|
||||
// {"node":{user1:"abc",password1:"123"}}
|
||||
var cryptedFlows = {"BADKEY":"5b89d8209b5158a3c313675561b1a5b5phN1gDBe81Zv98KqS/hVDmc9EKvaKqRIvcyXYvBlFNzzzJtvN7qfw06i"};
|
||||
credentials.init(runtime);
|
||||
credentials.load(cryptedFlows).then(function() {
|
||||
done();
|
||||
}).catch(function(err) {
|
||||
err.should.have.property('code','credentials_load_failed');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles unavailable settings - leaves creds unencrypted', function(done) {
|
||||
var runtime = {
|
||||
log: log,
|
||||
|
@@ -63,7 +63,7 @@ describe("red/nodes/index", function() {
|
||||
var runtime = {
|
||||
settings: settings,
|
||||
storage: storage,
|
||||
log: {debug:function() {}, warn:function() {}},
|
||||
log: {debug:function() {}, warn:function() {}, _: function() {}},
|
||||
events: new EventEmitter()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user