public ISiteSettings FetchNonAsync(int siteId) { ISiteSettings site = siteRepo.FetchNonAsync(siteId); dataProtector.UnProtect(site); return(site); }
public override IEnumerable <AuthenticationDescription> GetExternalAuthenticationSchemes() { //log.LogInformation("GetExternalAuthenticationSchemes called"); //https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs //https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.Http/Authentication/DefaultAuthenticationManager.cs IEnumerable <AuthenticationDescription> all = context.Authentication.GetAuthenticationSchemes().Where(d => !string.IsNullOrEmpty(d.DisplayName)); if (multiTenantOptions.Mode != MultiTenantMode.None) { // here we need to filter the list to ones configured for the current tenant if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { if (multiTenantOptions.UseRelatedSitesMode) { ISiteSettings site = siteRepo.FetchNonAsync(multiTenantOptions.RelatedSiteId); return(BuildFilteredAuthList(site, all)); } } return(BuildFilteredAuthList(SiteUserManager.Site, all)); } return(all); //return context.Authentication.GetAuthenticationSchemes(); }
public ISiteSettings Resolve(HttpContext context) { requestPath = context.Request.Path.Value; // this seems to behave different in IIS vs weblistener string pathBase = context.Request.PathBase; // this is true for folder sites if (pathBase.Length > 0) { if (!requestPath.StartsWith(pathBase)) { requestPath = pathBase + requestPath; } } host = context.Request.Host.Value; int siteId = -1; if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { string siteFolderName = GetFirstFolderSegment(requestPath); if (siteFolderName.Length == 0) { siteFolderName = "root"; } siteId = siteRepo.GetSiteIdByFolderNonAsync(siteFolderName); if (siteId == -1) { // error would be expected here on initial setup // when the db has not been set up and no site exists throw new InvalidOperationException("could not resolve site id"); } else { ISiteSettings site = siteRepo.FetchNonAsync(siteId); dataProtector.UnProtect(site); return(site); } } else { ISiteSettings site = siteRepo.FetchNonAsync(host); dataProtector.UnProtect(site); return(site); } }