-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
99 additions
and
7 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
17 changes: 17 additions & 0 deletions
17
TeachingRecordSystem/src/TeachingRecordSystem.Api/Endpoints/WebhookJwks.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,17 @@ | ||
using Microsoft.Extensions.Options; | ||
using TeachingRecordSystem.Core.Services.Webhooks; | ||
|
||
namespace TeachingRecordSystem.Api.Endpoints; | ||
|
||
public static class WebhookJwks | ||
{ | ||
public static IEndpointConventionBuilder MapWebhookJwks(this IEndpointRouteBuilder endpoints) | ||
{ | ||
return endpoints.MapGet("/webhook-jwks", async ctx => | ||
{ | ||
var webhookOptions = ctx.RequestServices.GetRequiredService<IOptions<WebhookOptions>>(); | ||
var jsonWebKeySet = webhookOptions.Value.GetJsonWebKeySet(); | ||
await ctx.Response.WriteAsJsonAsync(jsonWebKeySet); | ||
}); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
...ordSystem/src/TeachingRecordSystem.Core/Services/Webhooks/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,17 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace TeachingRecordSystem.Core.Services.Webhooks; | ||
|
||
public static class HostApplicationBuilderExtensions | ||
{ | ||
public static IHostApplicationBuilder AddWebhookOptions(this IHostApplicationBuilder builder) | ||
{ | ||
builder.Services.AddOptions<WebhookOptions>() | ||
.Bind(builder.Configuration.GetSection("Webhooks")) | ||
.ValidateDataAnnotations() | ||
.ValidateOnStart(); | ||
|
||
return builder; | ||
} | ||
} |
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