// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Features.Authentication; using Microsoft.AspNet.Http.Features.Authentication.Internal; namespace Microsoft.AspNet.Authentication { internal static class HttpContextExtensions { internal static IHttpAuthenticationFeature GetAuthentication(this HttpContext context) { var auth = context.Features.Get(); if (auth == null) { auth = new HttpAuthenticationFeature(); context.Features.Set(auth); } return auth; } } }