'SameSite=Lax',
`Path=${this.options.dingus.proxyPrefix}/`,
];
- if (this.options.authenticator.secureAuthOnly) {
+ if (this.secureAuthOnly) {
cookieParts.push('Secure');
}
res.setHeader(Enum.Header.SetCookie, cookieParts.join('; '));
const result = await authenticator.sessionCheck(req, res, ctx, loginPath, required, profilesAllowed);
assert.strictEqual(result, true);
});
+ it('covers valid insecure cookie session', async function () {
+ authenticator.secureAuthOnly = false;
+ req.getHeader.returns(cookie);
+ sinon.stub(authenticator, 'isValidCookieAuth').resolves(true);
+ ctx.session = {
+ authenticatedIdentifier: 'user',
+ };
+ const result = await authenticator.sessionCheck(req, res, ctx, loginPath, required, profilesAllowed);
+ assert.strictEqual(result, true);
+ });
it('rejects insecure connection', async function () {
ctx.clientProtocol = 'http';
try {