mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-05 23:29:00 +02:00
Merge pull request #17831 from overleaf/msm-filter-saml-error-log
[web] Filter saml error logs by path GitOrigin-RevId: 4ca9e156657afc893f38fed7ec6b00cbb7a608ef
This commit is contained in:
@@ -34,6 +34,7 @@ describe('SamlLogHandler', function () {
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
path: '/saml/ukamf',
|
||||
},
|
||||
data
|
||||
)
|
||||
@@ -62,6 +63,7 @@ describe('SamlLogHandler', function () {
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
path: '/saml/ukamf',
|
||||
},
|
||||
circularRef
|
||||
)
|
||||
@@ -91,6 +93,7 @@ describe('SamlLogHandler', function () {
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
path: '/saml/ukamf',
|
||||
},
|
||||
data
|
||||
)
|
||||
@@ -106,4 +109,54 @@ describe('SamlLogHandler', function () {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with /saml/group-sso path', function () {
|
||||
let err
|
||||
|
||||
beforeEach(async function () {
|
||||
err = new Error()
|
||||
samlLog.save = sinon.stub().rejects(err)
|
||||
|
||||
await SamlLogHandler.promises.log(
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
path: '/saml/group-sso',
|
||||
},
|
||||
data
|
||||
)
|
||||
})
|
||||
|
||||
it('should log error', function () {
|
||||
this.logger.error.should.have.been.calledOnce.and.calledWithMatch(
|
||||
{
|
||||
err,
|
||||
sessionId: sessionId.substr(0, 8),
|
||||
},
|
||||
'SamlLog Error'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a path not in the allow list', function () {
|
||||
let err
|
||||
|
||||
beforeEach(async function () {
|
||||
err = new Error()
|
||||
samlLog.save = sinon.stub().rejects(err)
|
||||
|
||||
await SamlLogHandler.promises.log(
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
path: '/unsupported',
|
||||
},
|
||||
data
|
||||
)
|
||||
})
|
||||
|
||||
it('should not log any error', function () {
|
||||
this.logger.error.should.not.have.been.called
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user