You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default serilog-ui allows access to the log page only for local requests. In order to give appropriate rights for production use, you need to configure authorization. You can secure the log page by allowing specific users or roles to view logs:
69
64
@@ -78,30 +73,39 @@ public void ConfigureServices(IServiceCollection services)
Only `User1` and `User2` oruserswith `AdminRole` rolecanviewlogs. Ifyouset `AuthenticationType` to `Jwt`, youcansetajwttokenandan `Authorization` headerwillbeaddedtotherequestandfor `Cookie` justloginintoyouwebsiteandnoextrastepisrequired.
79
+
Only `User1` and `User2` or users with `AdminRole` role can view logs.
80
+
81
+
If you set `AuthenticationType` to `Jwt`, you can set a jwt token and an `Authorization` header will be added to the request and for `Cookie` just login into you website and no extra step is required.
82
+
83
+
To disable anonymous access for local requests, (e.g. for testing authentication locally) set `AlwaysAllowLocalRequests` to `false`.
86
84
87
-
Todisableaccessforlocalrequests, (e.g. fortestingauthenticationlocally) set `AlwaysAllowLocalRequests` to`false`.
85
+
To disable authorization on production, set `Enabled` to false.
88
86
89
87
```csharp
90
88
services.AddSerilogUi(options=>options
91
89
.EnableAuthorization(authOption=>
92
90
{
93
-
authOption.AlwaysAllowLocalRequests=false;
91
+
authOption.AlwaysAllowLocalRequests=false; // disable anonymous access on local
92
+
authOption.Enabled=false; // disable authorization access check on production
Options can be found in the [UIOptions](src/Serilog.Ui.Web/Extensions/UiOptions.cs) class.
103
99
`internal` properties can generally be set via extension methods, see [SerilogUiOptionBuilderExtensions](src/Serilog.Ui.Web/Extensions/SerilogUiOptionBuilderExtensions.cs)
104
100
101
+
### Log page URL
102
+
103
+
The default url to view the log page is `http://<your-app>/serilog-ui`. If you want to change this url path, just configure the route prefix:
JS code can be ran when loading the file by wrapping the code in a function, and directly running that function like so:
@@ -147,7 +156,7 @@ JS code can be ran when loading the file by wrapping the code in a function, and
147
156
})();
148
157
```
149
158
150
-
## serilog-ui UI frontend development
159
+
## UI: Frontend development
151
160
152
161
The serilog-ui frontend is located inside the Serilog.Ui.Web package.
153
162
@@ -202,3 +211,37 @@ There are two Grunt tasks you can use to build the frontend project:
202
211
- restart Chrome
203
212
- you should be able to run the dev environment on both localhost and 127.0.0.1 (to check if it's working fine, open the console: you'll find a red message: **"[MSW] Mocking enabled."**)
204
213
</details>
214
+
215
+
# Known Limitations
216
+
* Additional columns are not supported and only main columns can be retrieved.
217
+
218
+
# Test
219
+
220
+
## .NET Serilog.UI Projects
221
+
222
+
The test projects are located inside the */tests* folder.
223
+
224
+
Each Serilog.Ui project has a separate test project.
225
+
Each project is based onto the **xUnit** test framework.
226
+
227
+
**Serilog.Ui.Common.Tests**: contains anything that can be shared between the tests projects.
228
+
229
+
To run the tests, use Test Explorer in Visual Studio or run from the root folder:
230
+
231
+
```
232
+
dotnet test
233
+
```
234
+
235
+
## JS UI assets
236
+
237
+
Tests are located inside src/Serilog.Ui.Web/assets/__tests__
238
+
239
+
Tests are based onto Jest test framework, with the help of JSDOM and testing-library packages. Any HTTP request is mocked through [msw](https://mswjs.io/).
240
+
241
+
Jest configuration can be found in src/Serilog.Ui.Web/jest.config.js; any additional setup item is located inside src/Serilog.Ui.Web/assets/__tests__/util (this folder is excluded from test runs).
242
+
243
+
To run the tests, open a terminal in src/Serilog.Ui.Web/ and launch this command (watch-mode):
0 commit comments