// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Net.WebSockets; using System.Security.Claims; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Http.Authentication; namespace Microsoft.AspNet.Http { public abstract class HttpContext : IDisposable { public abstract HttpRequest Request { get; } public abstract HttpResponse Response { get; } public abstract ConnectionInfo Connection { get; } public abstract ClaimsPrincipal User { get; set; } public abstract IDictionary Items { get; } public abstract IServiceProvider ApplicationServices { get; set; } public abstract IServiceProvider RequestServices { get; set; } public abstract CancellationToken RequestAborted { get; } public abstract ISessionCollection Session { get; } public abstract bool IsWebSocketRequest { get; } public abstract IList WebSocketRequestedProtocols { get; } public abstract void Abort(); public abstract void Dispose(); public abstract object GetFeature(Type type); public abstract void SetFeature(Type type, object instance); public virtual T GetFeature() { return (T)GetFeature(typeof(T)); } public virtual void SetFeature(T instance) { SetFeature(typeof(T), instance); } public abstract IEnumerable GetAuthenticationSchemes(); public abstract AuthenticationResult Authenticate(string authenticationScheme); public abstract Task AuthenticateAsync(string authenticationScheme); public virtual Task AcceptWebSocketAsync() { return AcceptWebSocketAsync(subProtocol: null); } public abstract Task AcceptWebSocketAsync(string subProtocol); } }