Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open source Tingle.AspNetCore.Authentication #132

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This repository contains projects/libraries for adding useful functionality to d

|Package|Version|Description|
|--|--|--|
|`Tingle.AspNetCore.Authentication`|[![NuGet](https://img.shields.io/nuget/v/Tingle.AspNetCore.Authentication.svg)](https://www.nuget.org/packages/Tingle.AspNetCore.Authentication/)|Convenience authentication functionality such as pass through and pre-shared key authentication mechanisms. See [docs](./src/Tingle.AspNetCore.Authentication/README.md) and [sample](./samples/AuthenticationSample)|
|`Tingle.AspNetCore.Authorization`|[![NuGet](https://img.shields.io/nuget/v/Tingle.AspNetCore.Authorization.svg)](https://www.nuget.org/packages/Tingle.AspNetCore.Authorization/)|Additional authorization functionality such as handlers and requirements. See [docs](./src/Tingle.AspNetCore.Authorization/README.md) and [sample](./samples/AuthorizationSample)|
|`Tingle.AspNetCore.DataProtection.MongoDB`|[![NuGet](https://img.shields.io/nuget/v/Tingle.AspNetCore.DataProtection.MongoDB.svg)](https://www.nuget.org/packages/Tingle.AspNetCore.DataProtection.MongoDB/)|Data Protection store in [MongoDB](https://mongodb.com) for ASP.NET Core. See [docs](./src/Tingle.AspNetCore.DataProtection.MongoDB/README.md) and [sample](./samples/DataProtectionMongoDBSample).|
|`Tingle.AspNetCore.JsonPatch.NewtonsoftJson`|[![NuGet](https://img.shields.io/nuget/v/Tingle.AspNetCore.JsonPatch.NewtonsoftJson.svg)](https://www.nuget.org/packages/Tingle.AspNetCore.JsonPatch.NewtonsoftJson/)|Helpers for validation when working with JsonPatch in ASP.NET Core. See [docs](./src/Tingle.AspNetCore.JsonPatch.NewtonsoftJson/README.md) and [blog](https://medium.com/swlh/immutable-properties-with-json-patch-in-aspnet-core-25185f493ea8).|
Expand Down
35 changes: 28 additions & 7 deletions Tingle.Extensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9546186D-D4E
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.Authentication", "src\Tingle.AspNetCore.Authentication\Tingle.AspNetCore.Authentication.csproj", "{98F3A2B7-5774-4E38-8FA0-FA13B6134454}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.Authorization", "src\Tingle.AspNetCore.Authorization\Tingle.AspNetCore.Authorization.csproj", "{22690754-DCFB-4CD2-968D-239C1952B52C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.DataProtection.MongoDB", "src\Tingle.AspNetCore.DataProtection.MongoDB\Tingle.AspNetCore.DataProtection.MongoDB.csproj", "{6F93ED1D-6475-46F2-A7DB-B2A5F9DB5A83}"
Expand All @@ -33,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{815F0941
tests\Directory.Build.props = tests\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.Authentication.Tests", "tests\Tingle.AspNetCore.Authentication.Tests\Tingle.AspNetCore.Authentication.Tests.csproj", "{A324CC70-36DD-4B38-9EC8-9069F6130FAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.Authorization.Tests", "tests\Tingle.AspNetCore.Authorization.Tests\Tingle.AspNetCore.Authorization.Tests.csproj", "{E67CB6B9-6F42-4E63-9603-810B5B9FBF57}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tingle.AspNetCore.DataProtection.MongoDB.Tests", "tests\Tingle.AspNetCore.DataProtection.MongoDB.Tests\Tingle.AspNetCore.DataProtection.MongoDB.Tests.csproj", "{E28F4E8D-148B-4583-A27D-E1DA2CC08167}"
Expand All @@ -58,10 +62,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{CE71
samples\Directory.Build.props = samples\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthorizationSample", "samples\AuthorizationSample\AuthorizationSample.csproj", "{B97964EC-658A-4205-AA5A-BB814B191C35}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCoreSessionState", "samples\AspNetCoreSessionState\AspNetCoreSessionState.csproj", "{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationSample", "samples\AuthenticationSample\AuthenticationSample.csproj", "{E04EC969-2539-46E9-B918-8C8B7BEB8828}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthorizationSample", "samples\AuthorizationSample\AuthorizationSample.csproj", "{B97964EC-658A-4205-AA5A-BB814B191C35}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProtectionMongoDBSample", "samples\DataProtectionMongoDBSample\DataProtectionMongoDBSample.csproj", "{ACED6271-2F75-4E3B-BB79-9D40B74D6A51}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpAuthenticationSample", "samples\HttpAuthenticationSample\HttpAuthenticationSample.csproj", "{37ED98F0-3129-49B8-BF60-3BDEBBB34822}"
Expand All @@ -74,6 +80,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{98F3A2B7-5774-4E38-8FA0-FA13B6134454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98F3A2B7-5774-4E38-8FA0-FA13B6134454}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98F3A2B7-5774-4E38-8FA0-FA13B6134454}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98F3A2B7-5774-4E38-8FA0-FA13B6134454}.Release|Any CPU.Build.0 = Release|Any CPU
{22690754-DCFB-4CD2-968D-239C1952B52C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22690754-DCFB-4CD2-968D-239C1952B52C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22690754-DCFB-4CD2-968D-239C1952B52C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -114,6 +124,10 @@ Global
{A803DE4B-B050-48F2-82A1-8E947D8FB96C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A803DE4B-B050-48F2-82A1-8E947D8FB96C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A803DE4B-B050-48F2-82A1-8E947D8FB96C}.Release|Any CPU.Build.0 = Release|Any CPU
{A324CC70-36DD-4B38-9EC8-9069F6130FAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A324CC70-36DD-4B38-9EC8-9069F6130FAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A324CC70-36DD-4B38-9EC8-9069F6130FAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A324CC70-36DD-4B38-9EC8-9069F6130FAC}.Release|Any CPU.Build.0 = Release|Any CPU
{E67CB6B9-6F42-4E63-9603-810B5B9FBF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E67CB6B9-6F42-4E63-9603-810B5B9FBF57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E67CB6B9-6F42-4E63-9603-810B5B9FBF57}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -154,14 +168,18 @@ Global
{978023EA-2ED5-4A28-96AD-4BB914EF2BE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{978023EA-2ED5-4A28-96AD-4BB914EF2BE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{978023EA-2ED5-4A28-96AD-4BB914EF2BE5}.Release|Any CPU.Build.0 = Release|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Release|Any CPU.Build.0 = Release|Any CPU
{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C}.Release|Any CPU.Build.0 = Release|Any CPU
{E04EC969-2539-46E9-B918-8C8B7BEB8828}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E04EC969-2539-46E9-B918-8C8B7BEB8828}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E04EC969-2539-46E9-B918-8C8B7BEB8828}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E04EC969-2539-46E9-B918-8C8B7BEB8828}.Release|Any CPU.Build.0 = Release|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B97964EC-658A-4205-AA5A-BB814B191C35}.Release|Any CPU.Build.0 = Release|Any CPU
{ACED6271-2F75-4E3B-BB79-9D40B74D6A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACED6271-2F75-4E3B-BB79-9D40B74D6A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACED6271-2F75-4E3B-BB79-9D40B74D6A51}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -179,6 +197,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{98F3A2B7-5774-4E38-8FA0-FA13B6134454} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{22690754-DCFB-4CD2-968D-239C1952B52C} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{6F93ED1D-6475-46F2-A7DB-B2A5F9DB5A83} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{82B17C91-B96A-4290-A623-6867912A4C8E} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
Expand All @@ -189,6 +208,7 @@ Global
{913C0212-58AC-42B7-B555-F96B8E287E7F} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{F46ADD04-B716-4E9B-9799-7C47DDDB08FC} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{A803DE4B-B050-48F2-82A1-8E947D8FB96C} = {9546186D-D4E1-4EDB-956E-1F81C7F4DB72}
{A324CC70-36DD-4B38-9EC8-9069F6130FAC} = {815F0941-3B70-4705-A583-AF627559595C}
{E67CB6B9-6F42-4E63-9603-810B5B9FBF57} = {815F0941-3B70-4705-A583-AF627559595C}
{E28F4E8D-148B-4583-A27D-E1DA2CC08167} = {815F0941-3B70-4705-A583-AF627559595C}
{55B3650C-36C6-4C05-B6A2-B4CBC3DC3E4C} = {815F0941-3B70-4705-A583-AF627559595C}
Expand All @@ -199,8 +219,9 @@ Global
{B82E2980-E145-4341-BAE0-8FAE1F110D0C} = {815F0941-3B70-4705-A583-AF627559595C}
{526B37AD-256A-445A-9A42-E5C53989B11E} = {815F0941-3B70-4705-A583-AF627559595C}
{978023EA-2ED5-4A28-96AD-4BB914EF2BE5} = {815F0941-3B70-4705-A583-AF627559595C}
{B97964EC-658A-4205-AA5A-BB814B191C35} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{CEF2A8D5-771F-42A1-B61D-9DEA4AB1921C} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{E04EC969-2539-46E9-B918-8C8B7BEB8828} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{B97964EC-658A-4205-AA5A-BB814B191C35} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{ACED6271-2F75-4E3B-BB79-9D40B74D6A51} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{37ED98F0-3129-49B8-BF60-3BDEBBB34822} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
{AC04C113-8F75-43BA-8FEE-987475A87C58} = {CE7124E9-01B3-4AD6-8B8F-FB302E60FB7F}
Expand Down
7 changes: 7 additions & 0 deletions samples/AuthenticationSample/AuthenticationSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<ItemGroup>
<ProjectReference Include="..\..\src\Tingle.AspNetCore.Authentication\Tingle.AspNetCore.Authentication.csproj" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions samples/AuthenticationSample/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

// Configure the HTTP request pipeline.

app.MapGet("/", async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});

app.Run();
27 changes: 27 additions & 0 deletions samples/AuthenticationSample/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51551",
"sslPort": 44347
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AuthenticationSample": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
52 changes: 52 additions & 0 deletions src/Tingle.AspNetCore.Authentication/AddressClaim.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Text.Json.Serialization;

namespace Tingle.AspNetCore.Authentication;

/// <summary>
/// Represents the object encoded into the '<c>address</c>' claim in JSON.
/// </summary>
public sealed record AddressClaim
{
/// <summary>
/// Full mailing address, formatted for display or use on a mailing label.
/// This field MAY contain multiple lines, separated by newlines.
/// Newlines can be represented either as a carriage return/line feed pair (\r\n)
/// or as a single line feed character (\n).
/// </summary>
[JsonPropertyName("formatted")]
public string? Formatted { get; set; }

/// <summary>
/// Full street address component, which MAY include house number, street name,
/// Post Office Box, and multi-line extended street address information. This
/// field MAY contain multiple lines, separated by newlines. Newlines can be
/// represented either as a carriage return/line feed pair (\r\n) or as a single
/// line feed character (\n)
/// </summary>
[JsonPropertyName("street_address")]
public string? StreetAddress { get; set; }

/// <summary>
/// City or locality component.
/// </summary>
[JsonPropertyName("locality")]
public string? Locality { get; set; }

/// <summary>
/// State, province, prefecture, or region component.
/// </summary>
[JsonPropertyName("region")]
public string? Region { get; set; }

/// <summary>
/// Zip code or postal code component.
/// </summary>
[JsonPropertyName("postal_code")]
public string? PostalCode { get; set; }

/// <summary>
/// Country name component.
/// </summary>
[JsonPropertyName("country")]
public string? Country { get; set; }
}
15 changes: 15 additions & 0 deletions src/Tingle.AspNetCore.Authentication/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Tingle.AspNetCore.Authentication;

/// <summary></summary>
internal static class Constants
{
/// <summary>
/// The URI for a claim that specifies the object identifier of an entity, http://schemas.microsoft.com/identity/claims/objectidentifier.
/// </summary>
public const string ObjectIdentifierClaimType = "http://schemas.microsoft.com/identity/claims/objectidentifier";

/// <summary>
/// The URI for a claim that specifies the tenant identifier of an entity, http://schemas.microsoft.com/identity/claims/tenantid.
/// </summary>
public const string TenantIdClaimType = "http://schemas.microsoft.com/identity/claims/tenantid";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Text.Json.Serialization;

namespace Tingle.AspNetCore.Authentication;

[JsonSerializable(typeof(AddressClaim))]
internal partial class CustomJsonSerializerContext : JsonSerializerContext { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Tingle.AspNetCore.Authentication.PassThrough;

namespace Microsoft.Extensions.DependencyInjection;

public static partial class AuthenticationBuilderExtensions
{
/// <summary>
/// Add authentication for PassThrough
/// </summary>
/// <param name="builder"></param>
/// <returns></returns>
public static AuthenticationBuilder AddPassThrough(this AuthenticationBuilder builder)
=> builder.AddPassThrough(PassThroughDefaults.AuthenticationScheme, _ => { });

/// <summary>
/// Add authentication for PassThrough
/// </summary>
/// <param name="builder"></param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddPassThrough(this AuthenticationBuilder builder, Action<PassThroughOptions> configureOptions)
=> builder.AddPassThrough(PassThroughDefaults.AuthenticationScheme, configureOptions);

/// <summary>
/// Add authentication for PassThrough
/// </summary>
/// <param name="builder"></param>
/// <param name="authenticationScheme">the name the scheme is to registered with</param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddPassThrough(this AuthenticationBuilder builder, string authenticationScheme, Action<PassThroughOptions> configureOptions)
=> builder.AddPassThrough(authenticationScheme, displayName: null, configureOptions: configureOptions);

/// <summary>
/// Add authentication for PassThrough
/// </summary>
/// <param name="builder"></param>
/// <param name="authenticationScheme">the name the scheme is to registered with</param>
/// <param name="displayName">the name to be used when displaying the scheme</param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddPassThrough(this AuthenticationBuilder builder, string authenticationScheme, string? displayName, Action<PassThroughOptions> configureOptions)
{
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<PassThroughOptions>, PassThroughPostConfigureOptions>());
return builder.AddScheme<PassThroughOptions, PassThroughHandler>(authenticationScheme, displayName, configureOptions);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Tingle.AspNetCore.Authentication.SharedKey;

namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Extensions on <see cref="AuthenticationBuilder"/> for SharedKey and PassThrough
/// </summary>
public static partial class AuthenticationBuilderExtensions
{
/// <summary>
/// Add authentication for shared key
/// </summary>
/// <param name="builder"></param>
/// <returns></returns>
public static AuthenticationBuilder AddSharedKey(this AuthenticationBuilder builder)
=> builder.AddSharedKey(SharedKeyDefaults.AuthenticationScheme, _ => { });

/// <summary>
/// Add authentication for shared key
/// </summary>
/// <param name="builder"></param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddSharedKey(this AuthenticationBuilder builder, Action<SharedKeyOptions> configureOptions)
=> builder.AddSharedKey(SharedKeyDefaults.AuthenticationScheme, configureOptions);

/// <summary>
/// Add authentication for shared key
/// </summary>
/// <param name="builder"></param>
/// <param name="authenticationScheme">the name the scheme is to registered with</param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddSharedKey(this AuthenticationBuilder builder, string authenticationScheme, Action<SharedKeyOptions> configureOptions)
=> builder.AddSharedKey(authenticationScheme, displayName: null, configureOptions: configureOptions);

/// <summary>
/// Add authentication for shared key
/// </summary>
/// <param name="builder"></param>
/// <param name="authenticationScheme">the name the scheme is to registered with</param>
/// <param name="displayName">the name to be used when displaying the scheme</param>
/// <param name="configureOptions"></param>
/// <returns></returns>
public static AuthenticationBuilder AddSharedKey(this AuthenticationBuilder builder, string authenticationScheme, string? displayName, Action<SharedKeyOptions> configureOptions)
{
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<SharedKeyOptions>, SharedKeyPostConfigureOptions>());
return builder.AddScheme<SharedKeyOptions, SharedKeyHandler>(authenticationScheme, displayName, configureOptions);
}
}
Loading