truncate sessionId in saml logs

GitOrigin-RevId: 45c369a88323e340875ae7b9f4d26e664ccdc8d8
This commit is contained in:
Ersun Warncke 2019-12-18 12:42:02 -04:00 committed by Copybot
parent 1c759ad413
commit 58077c4eff

View file

@ -2,19 +2,19 @@ const { SamlLog } = require('../../models/SamlLog')
const logger = require('logger-sharelatex')
function log(providerId, sessionId, data) {
const samlLog = new SamlLog()
samlLog.providerId = (providerId || '').toString()
samlLog.sessionId = sessionId
try {
const samlLog = new SamlLog()
samlLog.providerId = (providerId || '').toString()
samlLog.sessionId = (sessionId || '').toString().substr(0, 8)
samlLog.jsonData = JSON.stringify(data)
samlLog.save(err => {
if (err) {
logger.error({ err, sessionId, providerId }, 'SamlLog Error')
}
})
} catch (err) {
logger.error({ err, sessionId, providerId }, 'SamlLog JSON.stringify Error')
}
samlLog.save(err => {
if (err) {
logger.error({ err, sessionId, providerId }, 'SamlLog Error')
}
})
}
const SamlLogHandler = {