using Codelyzer.Analysis; using CTA.FeatureDetection.Common.Models.Features.Base; using CTA.Rules.Common.WebConfigManagement; namespace CTA.FeatureDetection.AuthType.CompiledFeatures { public class FormsAuthenticationFeature : WebConfigFeature { /// /// Determines if Forms Authentication is being used in a given project based on /// Web.config settings. /// /// Qualifications: /// 1. Web.config uses Forms authentication: /// /// /// /// /// /// /// /// /// Source code analysis results /// Whether or not Forms Authentication is used public override bool IsPresent(AnalyzerResult analyzerResult) { var config = WebConfigManager.LoadWebConfigAsXDocument(analyzerResult.ProjectResult.ProjectRootPath); return config.ContainsAttributeWithValue(Constants.AuthenticationElementElementPath, Constants.ModeAttribute, Constants.FormsAuthenticationType); } } }