예제 #1
0
        public static ApprovedDomain FindDomainByTenant(string tenant)
        {
            var    approved = new DomainSerializer("DomainsApproved.json");
            string domain   = approved.GetTenantMembers().FirstOrDefault(x => GetTenant(x) == tenant);
            var    instance = approved.Get().FirstOrDefault(x => domain != null && x.GetSubtenants().Contains(domain.ToLowerInvariant()));

            return(instance);
        }
예제 #2
0
        public static bool IsValidDomain(string domain = "")
        {
            if (string.IsNullOrWhiteSpace(domain))
            {
                domain = GetDomain();
                Log.Verbose($"The empty domain was automatically resolved to \"{domain}\".");
            }

            var serializer = new DomainSerializer("DomainsApproved.json");


            bool result = serializer.GetTenantMembers().Any(d => d == domain);

            if (!result)
            {
                Log.Information(
                    $"The domain \"{domain}\" was not found on list of approved domains. Please check your configuration");
            }

            return(result);
        }