Skip to content

Commit cda37f1

Browse files
authored
Merge pull request #43 from jorgevp/dev
(#42) Ability to enable and disable authentication
2 parents fa35875 + 9bab5e1 commit cda37f1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Serilog.Ui.Web/Extensions/AuthorizationOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class AuthorizationOptions
2929
/// Gets or sets a value indicating whether this <see cref="AuthorizationOptions"/> is enabled.
3030
/// </summary>
3131
/// <value> <c> true </c> if enabled; otherwise, <c> false </c>. </value>
32-
internal bool Enabled { get; set; } = false;
32+
public bool Enabled { get; set; } = true;
3333

3434
/// <summary>
3535
/// Whether to always allow local requests, defaults to <c>true</c>.

src/Serilog.Ui.Web/Extensions/SerilogUiOptionBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static SerilogUiOptionsBuilder EnableAuthorization(this SerilogUiOptionsB
2828
if (options == null)
2929
throw new ArgumentNullException(nameof(options));
3030

31-
var authorizationOptions = new AuthorizationOptions { Enabled = true };
31+
var authorizationOptions = new AuthorizationOptions();
3232
options(authorizationOptions);
3333

3434
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddSingleton(authorizationOptions);

src/Serilog.Ui.Web/SerilogUiMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private static bool CanAccess(HttpContext httpContext)
179179
return true;
180180

181181
if (!authOptions.Enabled)
182-
return false;
182+
return true;
183183

184184
if (!httpContext.User.Identity.IsAuthenticated)
185185
return false;

0 commit comments

Comments
 (0)