|
|
@ -93,7 +93,7 @@ async function checkToken(token) { |
|
|
|
instance.defaults.timeout = 30000; |
|
|
|
const res = await instance.post('/istokenvalidsso',params,options); |
|
|
|
if(res.status == 200){ |
|
|
|
console.log("check " +JSON.stringify(res.data)) |
|
|
|
//console.log("check " +JSON.stringify(res.data))
|
|
|
|
return res.data |
|
|
|
}else{ |
|
|
|
console.log("noerror: " + res) |
|
|
@ -298,6 +298,7 @@ cors(corsOptions), (req, res, next) => { |
|
|
|
var reslog = new Object(); |
|
|
|
reslog.log = obj |
|
|
|
|
|
|
|
reslog.test = usersession.SOCKET.user |
|
|
|
//var n = {}
|
|
|
|
//n.year = now.getFullYear();
|
|
|
|
//n.month = now.getMonth();
|
|
|
@ -346,9 +347,9 @@ io.on('connection', s => { |
|
|
|
// ------------------------------
|
|
|
|
// --- set
|
|
|
|
// ------------------------------
|
|
|
|
var global = new Object(); |
|
|
|
global.SOCKET = {}; |
|
|
|
global.SOCKET.error = {}; |
|
|
|
var usersession = new Object(); |
|
|
|
usersession.SOCKET = {}; |
|
|
|
usersession.SOCKET.error = {}; |
|
|
|
console.error('socket ...'); |
|
|
|
s.auth = false; |
|
|
|
|
|
|
@ -362,9 +363,9 @@ io.on('connection', s => { |
|
|
|
var isvalid = await checkToken(token); |
|
|
|
if(isvalid.action == 'ok'){ |
|
|
|
console.log("Authserver ok ", s.id + ' - ' + token); |
|
|
|
global.SOCKET.user = isvalid.user |
|
|
|
global.SOCKET.scope = isvalid.scope // space delimeter
|
|
|
|
global.SOCKET.token = isvalid.token |
|
|
|
usersession.SOCKET.user = isvalid.user |
|
|
|
usersession.SOCKET.scope = isvalid.scope // space delimeter
|
|
|
|
usersession.SOCKET.token = isvalid.token |
|
|
|
s.auth = true; |
|
|
|
}else{ |
|
|
|
console.log("Authserver no ", s.id + ' - ' + token); |
|
|
|