diff --git a/samples/SelfHostServer/Startup.cs b/samples/SelfHostServer/Startup.cs index ce7464d85f..a2948987dc 100644 --- a/samples/SelfHostServer/Startup.cs +++ b/samples/SelfHostServer/Startup.cs @@ -21,10 +21,10 @@ namespace SelfHostServer app.Run(async context => { - if (context.IsWebSocketRequest) + if (context.WebSockets.IsWebSocketRequest) { byte[] bytes = Encoding.ASCII.GetBytes("Hello World: " + DateTime.Now); - WebSocket webSocket = await context.AcceptWebSocketAsync(); + WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync(); await webSocket.SendAsync(new ArraySegment(bytes, 0, bytes.Length), WebSocketMessageType.Text, true, CancellationToken.None); await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Goodbye", CancellationToken.None); webSocket.Dispose(); diff --git a/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs b/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs index ed550f1074..4d65e87fda 100644 --- a/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs +++ b/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs @@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Server.WebListener _customChallenges = AuthenticationSchemes.None; } - public void Authenticate(IAuthenticateContext context) + public void Authenticate(AuthenticateContext context) { var user = _requestContext.User; var identity = user == null ? null : (ClaimsIdentity)user.Identity; @@ -67,13 +67,13 @@ namespace Microsoft.AspNet.Server.WebListener } } - public Task AuthenticateAsync(IAuthenticateContext context) + public Task AuthenticateAsync(AuthenticateContext context) { Authenticate(context); return Task.FromResult(0); } - public void Challenge(IChallengeContext context) + public void Challenge(ChallengeContext context) { foreach (var scheme in ListEnabledAuthSchemes()) { @@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Server.WebListener _requestContext.AuthenticationChallenges = _customChallenges; } - public void GetDescriptions(IDescribeSchemesContext context) + public void GetDescriptions(DescribeSchemesContext context) { // TODO: Caching, this data doesn't change per request. foreach (var scheme in ListEnabledAuthSchemes()) @@ -99,12 +99,12 @@ namespace Microsoft.AspNet.Server.WebListener } } - public void SignIn(ISignInContext context) + public void SignIn(SignInContext context) { // Not supported } - public void SignOut(ISignOutContext context) + public void SignOut(SignOutContext context) { // Not supported } diff --git a/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs b/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs index b2b0906caa..d3209b479b 100644 --- a/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs +++ b/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs @@ -410,7 +410,7 @@ namespace Microsoft.AspNet.Server.WebListener } } - Task IHttpWebSocketFeature.AcceptAsync(IWebSocketAcceptContext context) + Task IHttpWebSocketFeature.AcceptAsync(WebSocketAcceptContext context) { // TODO: Advanced params string subProtocol = null; diff --git a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs index d514a9f65c..446bef3b9d 100644 --- a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs @@ -201,7 +201,7 @@ namespace Microsoft.AspNet.Server.WebListener using (Utilities.CreateHttpAuthServer(authType | AuthenticationSchemes.AllowAnonymous, out address, env => { var context = new DefaultHttpContext((IFeatureCollection)env); - var resultList = context.GetAuthenticationSchemes(); + var resultList = context.Authentication.GetAuthenticationSchemes(); if (authType == AuthenticationSchemes.AllowAnonymous) { Assert.Equal(0, resultList.Count()); @@ -236,7 +236,7 @@ namespace Microsoft.AspNet.Server.WebListener using (Utilities.CreateHttpAuthServer(authType | AuthenticationSchemes.AllowAnonymous, out address, env => { var context = new DefaultHttpContext((IFeatureCollection)env); - var resultList = context.GetAuthenticationSchemes(); + var resultList = context.Authentication.GetAuthenticationSchemes(); Assert.Equal(4, resultList.Count()); return Task.FromResult(0); })) @@ -265,7 +265,7 @@ namespace Microsoft.AspNet.Server.WebListener Assert.False(context.User.Identity.IsAuthenticated); foreach (var scheme in authTypeList) { - var authResults = context.Authenticate(scheme); + var authResults = context.Authentication.Authenticate(scheme); Assert.Null(authResults); } return Task.FromResult(0); @@ -296,7 +296,7 @@ namespace Microsoft.AspNet.Server.WebListener var count = 0; foreach (var scheme in authTypeList) { - var authResults = context.Authenticate(scheme); + var authResults = context.Authentication.Authenticate(scheme); if (authResults != null) { count++; @@ -327,7 +327,7 @@ namespace Microsoft.AspNet.Server.WebListener var context = new DefaultHttpContext((IFeatureCollection)env); Assert.NotNull(context.User); Assert.False(context.User.Identity.IsAuthenticated); - context.Response.Challenge(); + context.Authentication.Challenge(); return Task.FromResult(0); })) { @@ -355,7 +355,7 @@ namespace Microsoft.AspNet.Server.WebListener Assert.False(context.User.Identity.IsAuthenticated); foreach (var scheme in authTypeList) { - context.Response.Challenge(scheme); + context.Authentication.Challenge(scheme); } return Task.FromResult(0); })) @@ -381,7 +381,7 @@ namespace Microsoft.AspNet.Server.WebListener var context = new DefaultHttpContext((IFeatureCollection)env); Assert.NotNull(context.User); Assert.False(context.User.Identity.IsAuthenticated); - context.Response.Challenge(authType.ToString()); + context.Authentication.Challenge(authType.ToString()); return Task.FromResult(0); })) { @@ -409,7 +409,7 @@ namespace Microsoft.AspNet.Server.WebListener var context = new DefaultHttpContext((IFeatureCollection)env); Assert.NotNull(context.User); Assert.False(context.User.Identity.IsAuthenticated); - Assert.Throws(() => context.Response.Challenge(authType.ToString())); + Assert.Throws(() => context.Authentication.Challenge(authType.ToString())); return Task.FromResult(0); })) {