GeoBlockAttribute Class
This annotation allows for the granular control GEO blocking in the firewall if GEO blocking modules are registered in service configuration
Namespace:
Walter.Web.FireWall.AnnotationsAssembly: Walter.Web.FireWall (in Walter.Web.FireWall.dll)
Syntax
[AttributeUsageAttribute] [CLSCompliantAttribute] public sealed class GeoBlockAttribute : BaseFireWallAttribute, IAuthorizationFilter, IEquatable<GeoBlockAttribute>
Remarks
Download any of the GEO blocking NuGet packages provided for the Firewall or write and register your own. Following NuGet packages are available but do require you to have your own data subscription:
Package Name | API | Database | File |
Walter.Web.FireWall.Geo.MaxMind | X | - | X |
Walter.Web.FireWall.Geo.IP2Location | X | X | - |
Walter.Web.FireWall.Geo.Google | X | - | - |
To create your own GEO provider implement one of these interfaces 1. ILatLongRepository (city and map coordinates), 2. IGeoAPIFactory (country code via API) 3. IGeoFactory (country code via database or file)
Examples
Register your own geo blocking middleware
public static IServiceCollection AddGeoBlocking(this IServiceCollection serviceCollection, GeoMethod useMethod) { //update configuration and set the type of call it makes. serviceCollection.Configure<IFireWallConfig>(opt => opt.Geography.UseMethod = useMethod); serviceCollection.AddSingleton(typeof(IGeoFactory), typeof(MyGeoRepository)); return serviceCollection; }
Inheritance Hierarchy
Walter.Web.FireWall.Annotations..::..GeoBlockAttribute
See Also
View the IPageRequest.ViolationsStack to access all violations on the page including those raised by this filter
IFireWall.OnGuardAction: Will be raised if the firewall considers blocking and allows you to override the blocking action
IFireWall.OnIncident: Will be raised if the firewall considers generating an incident and allows you to override the incident registration