Walter.BOM Namespace
Walter.Web.FireWall Namespace
ASP-WAF | .Net API for WAF Systems

UserTypeChangedEventArgs Class

Class UserTypeChangedEventArgs is triggered when the firewall detects a user group association change. Implements the EventArgs

Namespace:  Walter.Web.FireWall.EventArguments
Assembly:  Walter.Web.FireWall (in Walter.Web.FireWall.dll)

Syntax


public class UserTypeChangedEventArgs

Examples


The bellow sample assumes that you are using a ILogger instance to document the changes and that we never block a search engine as behaving badly
C#
private void MyFireWall_OnUserTypeChange(object? sender, UserTypeChangedEventArgs e)
   {
       _logger?.Lazy().LogDebug("User is being changed from {oldType} to {newType}\n  Route: {route}\n   Rules:\n   Data: {data}"
           , e.OriginalType
           , e.NewType
           , e.Rout
           , string.Join("\n   ", e.Rules)
           );

       //allow the change
       e.AllowRaiseIncident = true;

       if (e.OriginalType.HasFlag(UserTypes.IsSearchEngine) && e.NewType.HasFlag(UserTypes.IsMalicious))
       {
           //remove the malicious flag from search engines to not prevent search engines from
           //indexing the site
           e.NewType &= ~UserTypes.IsMalicious;
       }
   }