authelia/test/suites/basic/scenarii/VerifyEndpoint.ts
Clement Michaud 4016ff1bba [BREAKING] Create a suite for Traefik proxy.
* Removal of the Redirect header sent by Authelia /api/verify endpoint.
* Authelia does not consume Host header anymore but X-Forwarded-Proto and X-Forwarded-Host
  to compute the link sent in identity verification emails.
* Authelia used Host header as the application name for U2F authentication but it's now using
  X-Forwarded-* headers.
2019-04-12 09:24:54 +02:00

34 lines
1.4 KiB
TypeScript

import { GET_Expect401, GET_ExpectRedirect } from "../../../helpers/utils/Requests";
export default function() {
describe('Query without authenticated cookie', function() {
it('should get a 401 on GET to http://192.168.240.1:9091/api/verify', async function() {
await GET_Expect401('http://192.168.240.1:9091/api/verify', {
'X-Forwarded-Proto': 'https',
});
});
describe('Kubernetes nginx ingress controller', async function() {
it('should redirect to https://login.example.com:8080', async function() {
await GET_ExpectRedirect('http://192.168.240.1:9091/api/verify?rd=https://login.example.com:8080/%23/',
'https://login.example.com:8080/#/?rd=https://secure.example.com:8080',
{
'X-Original-Url': 'https://secure.example.com:8080',
'X-Forwarded-Proto': 'https'
});
});
});
describe('Traefik proxy', async function() {
it('should redirect to https://login.example.com:8080', async function() {
await GET_ExpectRedirect('http://192.168.240.1:9091/api/verify?rd=https://login.example.com:8080/%23/',
'https://login.example.com:8080/#/?rd=https://secure.example.com:8080/',
{
'X-Forwarded-Proto': 'https',
'X-Forwarded-Host': 'secure.example.com:8080',
'X-Forwarded-Uri': '/',
});
});
});
});
}