Sholo.Web.Security/Analysis/RequestAnalyzer.cs
/// <summary>
/// Creates a new instance of a FormsAuthenticationCookieAnalyzer
/// </summary>
/// <param name="formsAuthenticationCookie">The formsAuthenticationCookie to inspect</param>
/// <param name="requestPhase">The phase of the request procesisng lifecycle from which the analysis is being requested</param>
/// <param name="saveToContext">Whether or not to save the result of the analysis to the HttpContext.Current.Items collection</param>
Creates a new instance of a FormsAuthenticationCookieAnalyzer
Creates a new instance of a FormsAuthenticationCookieAnalyzer
public static RequestAnalysis AnalyzeRequest(HttpCookie formsAuthenticationCookie, RequestLifecyclePhase? requestPhase, bool saveToContext)
        {
            EnhancedSecurity.Initialize();
            ContextInformation context = new ContextInformation();
            FormsAuthenticationCookieAnalysis formsAuthenticationCookieResult = AnalyzeFormsAuthenticationCookie(formsAuthenticationCookie);
            FormsAuthenticationTicketAnalysis formsAuthenticationTicketResult;
            UserAuthenticationTicketAnalysis userAuthenticationTicketResult;
            if (UserAuthentication.Enabled)
            {
                formsAuthenticationTicketResult = AnalyzeFormsAuthenticationTicket(formsAuthenticationCookieResult, true, requestPhase);
                userAuthenticationTicketResult = AnalyzeServerAuthenticationTicket(context, formsAuthenticationCookieResult, formsAuthenticationTicketResult, UserAuthentication.EnforceClientHostAddressValidation);
            }
            else
            {
                formsAuthenticationTicketResult = AnalyzeFormsAuthenticationTicket(formsAuthenticationCookieResult, false, requestPhase);
                userAuthenticationTicketResult = new UserAuthenticationTicketAnalysis();
            }
            RequestAnalysis result = new RequestAnalysis(context, formsAuthenticationCookieResult, formsAuthenticationTicketResult, userAuthenticationTicketResult);
            if (saveToContext)
            {
                string contextKey = "Analysis:" + requestPhase.ToString();
                HttpContext.Current.Items[contextKey] = result;
            }
            return result;
        }
public static RequestAnalysis AnalyzeRequest ( HttpCookie formsAuthenticationCookie , RequestLifecyclePhase ? requestPhase , bool saveToContext ) { EnhancedSecurity . Initialize ( ) ; ContextInformation context = new ContextInformation ( ) ; FormsAuthenticationCookieAnalysis formsAuthenticationCookieResult = AnalyzeFormsAuthenticationCookie ( formsAuthenticationCookie ) ; FormsAuthenticationTicketAnalysis formsAuthenticationTicketResult ; UserAuthenticationTicketAnalysis userAuthenticationTicketResult ; if ( UserAuthentication . Enabled ) { formsAuthenticationTicketResult = AnalyzeFormsAuthenticationTicket ( formsAuthenticationCookieResult , true , requestPhase ) ; userAuthenticationTicketResult = AnalyzeServerAuthenticationTicket ( context , formsAuthenticationCookieResult , formsAuthenticationTicketResult , UserAuthentication . EnforceClientHostAddressValidation ) ; } else { formsAuthenticationTicketResult = AnalyzeFormsAuthenticationTicket ( formsAuthenticationCookieResult , false , requestPhase ) ; userAuthenticationTicketResult = new UserAuthenticationTicketAnalysis ( ) ; } RequestAnalysis result = new RequestAnalysis ( context , formsAuthenticationCookieResult , formsAuthenticationTicketResult , userAuthenticationTicketResult ) ; if ( saveToContext ) { string contextKey = " " + requestPhase . ToString ( ) ; HttpContext . Current . Items [ contextKey ] = result ; } return result ; }
Creates a new instance of a FormsAuthenticationCookieAnalyzer
Creates a new instance of a FormsAuthenticationCookieAnalyzer
formsAuthenticationCookie
HttpCookie
The formsAuthenticationCookie to inspect
The formsAuthenticationCookie to inspect
requestPhase
RequestLifecyclePhase?
The phase of the request procesisng lifecycle from which the analysis is being requested
The phase of the request procesisng lifecycle from which the analysis is being requested
saveToContext
bool
Whether or not to save the result of the analysis to the HttpContext.Current.Items collection
Whether or not to save the result of the analysis to the HttpContext . Current . Items collection