mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Before this fix an anonymous user was not able to access a resource that were configured with a bypass policy. This was due to a useless check of the userid in the auth session. Moreover, in the case of an anonymous user, we should not check the inactivity period since there is no session. Also refactor /verify endpoint for better testability and add tests in a new suite.
20 lines
611 B
TypeScript
20 lines
611 B
TypeScript
import * as Express from "express";
|
|
import GetHeader from "./GetHeader";
|
|
import { RequestMock } from "../stubs/express.spec";
|
|
import * as Assert from "assert";
|
|
|
|
describe('utils/GetHeader', function() {
|
|
let req: Express.Request;
|
|
beforeEach(() => {
|
|
req = RequestMock();
|
|
});
|
|
|
|
it('should return the header if it exists', function() {
|
|
req.headers["x-target-url"] = 'www.example.com';
|
|
Assert.equal(GetHeader(req, 'x-target-url'), 'www.example.com');
|
|
});
|
|
|
|
it('should return undefined if header does not exist', function() {
|
|
Assert.equal(GetHeader(req, 'x-target-url'), undefined);
|
|
});
|
|
}); |