microsoft/healthcare-shared-components
Publicmirrored from https://github.com/microsoft/healthcare-shared-componentsAvailable
src/Microsoft.Health.Api/Features/Context/RequestContextAfterAuthenticationMiddlewareExtensions.cs
22lines · modecode
| 1 | // ------------------------------------------------------------------------------------------------- |
| 2 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. |
| 4 | // ------------------------------------------------------------------------------------------------- |
| 5 | |
| 6 | using EnsureThat; |
| 7 | using Microsoft.AspNetCore.Builder; |
| 8 | using Microsoft.Health.Core.Features.Context; |
| 9 | |
| 10 | namespace Microsoft.Health.Api.Features.Context; |
| 11 | |
| 12 | public static class RequestContextAfterAuthenticationMiddlewareExtensions |
| 13 | { |
| 14 | public static IApplicationBuilder UseRequestContextAfterAuthentication<T>( |
| 15 | this IApplicationBuilder builder) |
| 16 | where T : IRequestContext |
| 17 | { |
| 18 | EnsureArg.IsNotNull(builder, nameof(builder)); |
| 19 | |
| 20 | return builder.UseMiddleware<RequestContextAfterAuthenticationMiddleware<T>>(); |
| 21 | } |
| 22 | } |
| 23 | |