-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XML documentation to extensions.
- Loading branch information
Showing
12 changed files
with
160 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 17 additions & 3 deletions
20
src/Serilog.Ui.PostgreSqlProvider/Extensions/SerilogUiOptionBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Serilog.Ui.Web/Extensions/ApplicationBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System; | ||
|
||
namespace Serilog.Ui.Web | ||
{ | ||
/// <summary> | ||
/// Contains extensions for configuring routing on an <see cref="IApplicationBuilder"/>. | ||
/// </summary> | ||
public static class ApplicationBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Adds a <see cref="SerilogUiMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>. | ||
/// </summary> | ||
/// <param name="applicationBuilder"> | ||
/// The <see cref="IApplicationBuilder"/> to add the middleware to. | ||
/// </param> | ||
/// <param name="options"> The options to configure SerilogUI dashboard. </param> | ||
/// <returns> IApplicationBuilder. </returns> | ||
/// <exception cref="ArgumentNullException"> throw if applicationBuilder if null </exception> | ||
public static IApplicationBuilder UseSerilogUi(this IApplicationBuilder applicationBuilder, Action<UiOptions> options = null) | ||
{ | ||
if (applicationBuilder == null) | ||
throw new ArgumentNullException(nameof(applicationBuilder)); | ||
|
||
var uiOptions = new UiOptions(); | ||
options?.Invoke(uiOptions); | ||
|
||
var scope = applicationBuilder.ApplicationServices.CreateScope(); | ||
var authOptions = scope.ServiceProvider.GetService<AuthorizationOptions>(); | ||
uiOptions.AuthType = authOptions.AuthenticationType.ToString(); | ||
|
||
scope.Dispose(); | ||
|
||
return applicationBuilder.UseMiddleware<SerilogUiMiddleware>(uiOptions); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
namespace Serilog.Ui.Web | ||
{ | ||
/// <summary> | ||
/// The options to be used by SerilogUI to configure log dashboard. You normally use a <see | ||
/// cref="Core.SerilogUiOptionsBuilder"/> to create instances of this class. | ||
/// </summary> | ||
public class UiOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the route prefix to access log dashboard via browser. The default value | ||
/// is <c> serilog-ui </c> and you can the dashboard by using <c> | ||
/// http://localhost/serilog-ui </c> | ||
/// </summary> | ||
/// <value> The route prefix. </value> | ||
public string RoutePrefix { get; set; } = "serilog-ui"; | ||
|
||
/// <summary> | ||
/// Gets or sets the type of the authentication. | ||
/// </summary> | ||
/// <value> The type of the authentication. </value> | ||
internal string AuthType { get; set; } | ||
} | ||
} |