Merge branch 'master' into commercial
This commit is contained in:
commit
cc58fcb98a
28
lib/relay.js
28
lib/relay.js
|
@ -257,9 +257,18 @@ var Server = {
|
||||||
newAuth = JSON.stringify(newAuth);
|
newAuth = JSON.stringify(newAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO don't fire the onAuth event on non-authz updates
|
||||||
|
if (!grant.jwt && !(grant.domains||[]).length && !(grant.ports||[]).length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
console.log('[onAuth] check for upgrade token');
|
console.log('[onAuth] check for upgrade token');
|
||||||
if (grant.jwt && newAuth !== grant.jwt) {
|
if (grant.jwt) {
|
||||||
console.log('new token to send back');
|
if (newAuth !== grant.jwt) {
|
||||||
|
console.log('[onAuth] new token to send back');
|
||||||
|
}
|
||||||
|
// TODO only send token when new
|
||||||
|
if (true) {
|
||||||
// Access Token
|
// Access Token
|
||||||
Server.sendTunnelMsg(
|
Server.sendTunnelMsg(
|
||||||
srv
|
srv
|
||||||
|
@ -273,6 +282,7 @@ var Server = {
|
||||||
// these aren't needed internally once they're sent
|
// these aren't needed internally once they're sent
|
||||||
grant.jwt = null;
|
grant.jwt = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!Array.isArray(grant.domains) || !grant.domains.length) {
|
if (!Array.isArray(grant.domains) || !grant.domains.length) {
|
||||||
|
@ -425,22 +435,24 @@ var Server = {
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.authenticate({ auth: newAuth }).then(function (authnToken) {
|
return state.authenticate({ auth: newAuth }).then(function (authnToken) {
|
||||||
|
|
||||||
console.log('\n[relay.js] newAuth');
|
console.log('\n[relay.js] newAuth');
|
||||||
console.log(newAuth);
|
console.log(newAuth);
|
||||||
|
|
||||||
console.log('\n[relay.js] authnToken');
|
console.log('\n[relay.js] authnToken');
|
||||||
console.log(authnToken);
|
console.log(authnToken);
|
||||||
|
|
||||||
if (authnToken.id) {
|
// For tracking state between token exchanges
|
||||||
state.srvs[authnToken.id] = state.srvs[authnToken.id] || {};
|
// and tacking on extra attributes (i.e. for extensions)
|
||||||
|
// TODO close on delete
|
||||||
|
if (!state.srvs[authnToken.id]) {
|
||||||
|
state.srvs[authnToken.id] = {};
|
||||||
|
}
|
||||||
|
if (!state.srvs[authnToken.id].updateAuth) {
|
||||||
state.srvs[authnToken.id].updateAuth = function (validToken) {
|
state.srvs[authnToken.id].updateAuth = function (validToken) {
|
||||||
return Server.onAuth(state, srv, newAuth, validToken);
|
return Server.onAuth(state, srv, newAuth, validToken);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
state.srvs[authnToken.id].updateAuth(authnToken);
|
||||||
// will return rejection if necessary
|
|
||||||
return state.srvs[authnToken.id].updateAuth(authnToken);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
, removeToken: function removeToken(state, srv, jwtoken) {
|
, removeToken: function removeToken(state, srv, jwtoken) {
|
||||||
|
|
Loading…
Reference in New Issue