authelia/shared/BelongToDomain.ts
2018-12-18 16:34:56 +01:00

8 lines
301 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { DomainExtractor } from "./DomainExtractor";
export function BelongToDomain(url: string, domain: string): boolean {
const urlDomain =  DomainExtractor.fromUrl(url);
if (!urlDomain) return false;
const idx = urlDomain.indexOf(domain);
return idx + domain.length == urlDomain.length;
}