Sholo.Web.Security/Analysis/RequestAnalyzer.cs
/// <summary>
/// Performs a comparison of analyses taken a different points in the request processing pipeline
/// </summary>
/// <param name="before">The prior analysis</param>
/// <param name="after">The current analysis</param>
/// <returns>A conclusion derived from the analysis change</returns>
Performs a comparison of analyses taken a different points in the request processing pipeline
Performs a comparison of analyses taken a different points in the request processing pipeline
public static ComparisonResult Compare(RequestAnalysis before, RequestAnalysis after)
        {
            if (before.RequestIsMalicious || after.RequestIsMalicious)
            {
                return ComparisonResult.MaliciousRequest;
            }
            if (before.RequestIsAuthenticated && after.RequestIsAuthenticated)
            {
                return ComparisonResult.AuthenticatedRequest;
            }
            if (before.RequestIsAuthenticated && !after.RequestIsAuthenticated)
            {
                return ComparisonResult.LogoutRequest;
            }
            if (!before.RequestIsAuthenticated && !after.RequestIsAuthenticated && before.FormsAuthenticationCookieResult.IsExpired)
            {
                return ComparisonResult.LogoutRequest;
            }
            if (!before.RequestIsAuthenticated && after.RequestIsAuthenticated)
            {
                return ComparisonResult.LoginRequest;
            }
            return ComparisonResult.UnauthenticatedRequest;
        }
public static ComparisonResult Compare ( RequestAnalysis before , RequestAnalysis after ) { if ( before . RequestIsMalicious || after . RequestIsMalicious ) { return ComparisonResult . MaliciousRequest ; } if ( before . RequestIsAuthenticated && after . RequestIsAuthenticated ) { return ComparisonResult . AuthenticatedRequest ; } if ( before . RequestIsAuthenticated && ! after . RequestIsAuthenticated ) { return ComparisonResult . LogoutRequest ; } if ( ! before . RequestIsAuthenticated && ! after . RequestIsAuthenticated && before . FormsAuthenticationCookieResult . IsExpired ) { return ComparisonResult . LogoutRequest ; } if ( ! before . RequestIsAuthenticated && after . RequestIsAuthenticated ) { return ComparisonResult . LoginRequest ; } return ComparisonResult . UnauthenticatedRequest ; }
Performs a comparison of analyses taken a different points in the request processing pipeline
Performs a comparison of analyses taken a different points in the request processing pipeline
A conclusion derived from the analysis change
A conclusion derived from the analysis change
before
RequestAnalysis
The prior analysis
The prior analysis
after
RequestAnalysis
The current analysis
The current analysis