Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit e52a540

Browse files
committed
Update README.md with information about authorization. Explains #12
1 parent afdfcaa commit e52a540

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,15 @@ var log = new LoggerConfiguration()
3636
.Enrich.With(new WebApiRouteTemplateEnricher("RouteTemplate")
3737
.CreateLogger();
3838
```
39+
40+
## Authorization
41+
In Web Api, authorization filters execute before action filters. If a request is unauthorized, the action filters are not processed.
42+
An authorize filter attribute is available which adds enricher support in the event that the request is unauthorized. You can use this directly:
43+
```csharp
44+
[SerilogWeb.Classic.WebApi.StoreWebApInfoInHttpContextAuthorizeFilter]
45+
public void Get()
46+
{
47+
}
48+
```
49+
50+
Alternatively, you can create your own Authorize filter attribute which inherits from ```SerilogWeb.Classic.WebApi.StoreWebApInfoInHttpContextAuthorizeFilter```, and use that instead.

0 commit comments

Comments
 (0)