diff --git a/samples/SocialSample/Startup.cs b/samples/SocialSample/Startup.cs index 59c57862ae..f1bc5b335f 100644 --- a/samples/SocialSample/Startup.cs +++ b/samples/SocialSample/Startup.cs @@ -72,26 +72,29 @@ namespace CookieSample // You must first create an app with facebook and add it's ID and Secret to your config.json or user-secrets. // https://developers.facebook.com/apps/ - app.UseFacebookAuthentication(new FacebookOptions() + app.UseFacebookAuthentication(options => { - AppId = Configuration["facebook:appid"], - AppSecret = Configuration["facebook:appsecret"], - Scope = { "email" }, - Fields = { "name", "email" }, + options.AppId = Configuration["facebook:appid"]; + options.AppSecret = Configuration["facebook:appsecret"]; + options.Scope.Add("email"); + options.Fields.Add("name"); + options.Fields.Add("email"); }); // See config.json - app.UseOAuthAuthentication(new OAuthOptions + app.UseOAuthAuthentication(options => { - AuthenticationScheme = "Google-AccessToken", - DisplayName = "Google-AccessToken", - ClientId = Configuration["google:clientid"], - ClientSecret = Configuration["google:clientsecret"], - CallbackPath = new PathString("/signin-google-token"), - AuthorizationEndpoint = GoogleDefaults.AuthorizationEndpoint, - TokenEndpoint = GoogleDefaults.TokenEndpoint, - Scope = { "openid", "profile", "email" }, - SaveTokensAsClaims = true + options.AuthenticationScheme = "Google-AccessToken"; + options.DisplayName = "Google-AccessToken"; + options.ClientId = Configuration["google:clientid"]; + options.ClientSecret = Configuration["google:clientsecret"]; + options.CallbackPath = new PathString("/signin-google-token"); + options.AuthorizationEndpoint = GoogleDefaults.AuthorizationEndpoint; + options.TokenEndpoint = GoogleDefaults.TokenEndpoint; + options.Scope.Add("openid"); + options.Scope.Add("profile"); + options.Scope.Add("email"); + options.SaveTokensAsClaims = true; }); // See config.json @@ -148,17 +151,17 @@ namespace CookieSample The sample app can then be run via: dnx . web */ - app.UseOAuthAuthentication(new OAuthOptions + app.UseOAuthAuthentication(options => { - AuthenticationScheme = "Microsoft-AccessToken", - DisplayName = "MicrosoftAccount-AccessToken - Requires project changes", - ClientId = Configuration["msa:clientid"], - ClientSecret = Configuration["msa:clientsecret"], - CallbackPath = new PathString("/signin-microsoft-token"), - AuthorizationEndpoint = MicrosoftAccountDefaults.AuthorizationEndpoint, - TokenEndpoint = MicrosoftAccountDefaults.TokenEndpoint, - Scope = { "wl.basic" }, - SaveTokensAsClaims = true + options.AuthenticationScheme = "Microsoft-AccessToken"; + options.DisplayName = "MicrosoftAccount-AccessToken - Requires project changes"; + options.ClientId = Configuration["msa:clientid"]; + options.ClientSecret = Configuration["msa:clientsecret"]; + options.CallbackPath = new PathString("/signin-microsoft-token"); + options.AuthorizationEndpoint = MicrosoftAccountDefaults.AuthorizationEndpoint; + options.TokenEndpoint = MicrosoftAccountDefaults.TokenEndpoint; + options.Scope.Add("wl.basic"); + options.SaveTokensAsClaims = true; }); //// You must first create an app with live.com and add it's ID and Secret to your config.json or user-secrets. @@ -172,32 +175,32 @@ namespace CookieSample // See config.json // https://github.com/settings/applications/ - app.UseOAuthAuthentication(new OAuthOptions + app.UseOAuthAuthentication(options => { - AuthenticationScheme = "GitHub-AccessToken", - DisplayName = "Github-AccessToken", - ClientId = Configuration["github-token:clientid"], - ClientSecret = Configuration["github-token:clientsecret"], - CallbackPath = new PathString("/signin-github-token"), - AuthorizationEndpoint = "https://github.com/login/oauth/authorize", - TokenEndpoint = "https://github.com/login/oauth/access_token", - SaveTokensAsClaims = true + options.AuthenticationScheme = "GitHub-AccessToken"; + options.DisplayName = "Github-AccessToken"; + options.ClientId = Configuration["github-token:clientid"]; + options.ClientSecret = Configuration["github-token:clientsecret"]; + options.CallbackPath = new PathString("/signin-github-token"); + options.AuthorizationEndpoint = "https://github.com/login/oauth/authorize"; + options.TokenEndpoint = "https://github.com/login/oauth/access_token"; + options.SaveTokensAsClaims = true; }); // See config.json - app.UseOAuthAuthentication(new OAuthOptions + app.UseOAuthAuthentication(options => { - AuthenticationScheme = "GitHub", - DisplayName = "Github", - ClientId = Configuration["github:clientid"], - ClientSecret = Configuration["github:clientsecret"], - CallbackPath = new PathString("/signin-github"), - AuthorizationEndpoint = "https://github.com/login/oauth/authorize", - TokenEndpoint = "https://github.com/login/oauth/access_token", - UserInformationEndpoint = "https://api.github.com/user", - ClaimsIssuer = "OAuth2-Github", + options.AuthenticationScheme = "GitHub"; + options.DisplayName = "Github"; + options.ClientId = Configuration["github:clientid"]; + options.ClientSecret = Configuration["github:clientsecret"]; + options.CallbackPath = new PathString("/signin-github"); + options.AuthorizationEndpoint = "https://github.com/login/oauth/authorize"; + options.TokenEndpoint = "https://github.com/login/oauth/access_token"; + options.UserInformationEndpoint = "https://api.github.com/user"; + options.ClaimsIssuer = "OAuth2-Github"; // Retrieving user information is unique to each provider. - Events = new OAuthEvents + options.Events = new OAuthEvents { OnCreatingTicket = async context => { @@ -210,7 +213,7 @@ namespace CookieSample response.EnsureSuccessStatusCode(); var user = JObject.Parse(await response.Content.ReadAsStringAsync()); - + var identifier = user.Value("id"); if (!string.IsNullOrEmpty(identifier)) { @@ -243,7 +246,7 @@ namespace CookieSample ClaimValueTypes.String, context.Options.ClaimsIssuer)); } } - } + }; }); // Choose an authentication type diff --git a/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs index 0a8cd12ce4..46539f875c 100644 --- a/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Builder throw new ArgumentNullException(nameof(app)); } - return app.UseCookieAuthentication(new CookieAuthenticationOptions()); + return app.UseCookieAuthentication(options => { }); } /// @@ -38,32 +38,13 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new CookieAuthenticationOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseCookieAuthentication(options); - } - - /// - /// Adds the middleware to the specified , which enables cookie authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseCookieAuthentication(this IApplicationBuilder app, CookieAuthenticationOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + configureOptions(options); return app.UseMiddleware(options); } diff --git a/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs index 0889ec6ece..cc9b73f48b 100644 --- a/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs @@ -11,27 +11,6 @@ namespace Microsoft.AspNet.Builder /// public static class FacebookAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables Facebook authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, FacebookOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables Facebook authentication capabilities. /// @@ -44,13 +23,15 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new FacebookOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseFacebookAuthentication(options); + configureOptions(options); + + return app.UseMiddleware(options); } } } diff --git a/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs index 67993bbc2e..88e56928f8 100644 --- a/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs @@ -11,27 +11,6 @@ namespace Microsoft.AspNet.Builder /// public static class GoogleAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables Google authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, GoogleOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables Google authentication capabilities. /// @@ -44,13 +23,15 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new GoogleOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseGoogleAuthentication(options); + configureOptions(options); + + return app.UseMiddleware(options); } } } diff --git a/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs index 80494f09d8..0a1d01e446 100644 --- a/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs @@ -11,33 +11,6 @@ namespace Microsoft.AspNet.Builder /// public static class JwtBearerAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables Bearer token processing capabilities. - /// This middleware understands appropriately - /// formatted and secured tokens which appear in the request header. If the Options.AuthenticationMode is Active, the - /// claims within the bearer token are added to the current request's IPrincipal User. If the Options.AuthenticationMode - /// is Passive, then the current request is not modified, but IAuthenticationManager AuthenticateAsync may be used at - /// any time to obtain the claims from the request's bearer token. - /// See also http://tools.ietf.org/html/rfc6749 - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseJwtBearerAuthentication(this IApplicationBuilder app, JwtBearerOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables Bearer token processing capabilities. /// This middleware understands appropriately @@ -56,13 +29,15 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new JwtBearerOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseJwtBearerAuthentication(options); + configureOptions(options); + + return app.UseMiddleware(options); } } } diff --git a/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs index 37a8d4180d..34b2ae0709 100644 --- a/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs @@ -11,27 +11,6 @@ namespace Microsoft.AspNet.Builder /// public static class MicrosoftAccountAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables Microsoft Account authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseMicrosoftAccountAuthentication(this IApplicationBuilder app, MicrosoftAccountOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables Microsoft Account authentication capabilities. /// @@ -44,13 +23,15 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new MicrosoftAccountOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseMicrosoftAccountAuthentication(options); + configureOptions(options); + + return app.UseMiddleware(options); } } } diff --git a/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs index 18aa623624..93db92caba 100644 --- a/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs @@ -23,37 +23,13 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } - if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new OAuthOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseOAuthAuthentication(options); - } - - /// - /// Adds the middleware to the specified , which enables OAuth 2.0 authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseOAuthAuthentication(this IApplicationBuilder app, OAuthOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + configureOptions(options); return app.UseMiddleware>(options); } diff --git a/src/Microsoft.AspNet.Authentication.OAuth/OAuthOptions.cs b/src/Microsoft.AspNet.Authentication.OAuth/OAuthOptions.cs index ba689e66b1..a79c546725 100644 --- a/src/Microsoft.AspNet.Authentication.OAuth/OAuthOptions.cs +++ b/src/Microsoft.AspNet.Authentication.OAuth/OAuthOptions.cs @@ -1,10 +1,7 @@ // 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 System; using System.Collections.Generic; -using System.Net.Http; -using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Authentication; namespace Microsoft.AspNet.Authentication.OAuth diff --git a/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs index f9b064137f..5f22512261 100644 --- a/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs @@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Builder /// Adds the middleware to the specified , which enables OpenID Connect authentication capabilities. /// /// The to add the middleware to. - /// An action delegate to configure the provided . + /// An action delegate to configure the provided . /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseOpenIdConnectAuthentication(this IApplicationBuilder app, Action configureOptions) { @@ -23,33 +23,13 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } - + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new OpenIdConnectOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseOpenIdConnectAuthentication(options); - } - - /// - /// Adds the middleware to the specified , which enables OpenID Connect authentication capabilities. - /// - /// The to add the middleware to. - /// An that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseOpenIdConnectAuthentication(this IApplicationBuilder app, OpenIdConnectOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + configureOptions(options); return app.UseMiddleware(options); } diff --git a/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs index efff5937ae..024d04e697 100644 --- a/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs @@ -23,32 +23,13 @@ namespace Microsoft.AspNet.Builder { throw new ArgumentNullException(nameof(app)); } + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } var options = new TwitterOptions(); - if (configureOptions != null) - { - configureOptions(options); - } - return app.UseTwitterAuthentication(options); - } - - /// - /// Adds the middleware to the specified , which enables Twitter authentication capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseTwitterAuthentication(this IApplicationBuilder app, TwitterOptions options) - { - if (app == null) - { - throw new ArgumentNullException(nameof(app)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + configureOptions(options); return app.UseMiddleware(options); } diff --git a/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs index 4086c95915..702e65627b 100644 --- a/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs @@ -13,17 +13,6 @@ namespace Microsoft.AspNet.Builder /// public static class ClaimsTransformationAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables claims transformation capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, ClaimsTransformationOptions options) - { - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables claims transformation capabilities. /// @@ -32,12 +21,19 @@ namespace Microsoft.AspNet.Builder /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Func> transform) { - var options = new ClaimsTransformationOptions(); - options.Transformer = new ClaimsTransformer + if (app == null) { - OnTransform = transform - }; - return app.UseClaimsTransformation(options); + throw new ArgumentNullException(nameof(app)); + } + if (transform == null) + { + throw new ArgumentNullException(nameof(transform)); + } + + return app.UseClaimsTransformation(options => + { + options.Transformer = new ClaimsTransformer { OnTransform = transform }; + }); } /// @@ -48,12 +44,19 @@ namespace Microsoft.AspNet.Builder /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Action configureOptions) { - var options = new ClaimsTransformationOptions(); - if (configureOptions != null) + if (app == null) { - configureOptions(options); + throw new ArgumentNullException(nameof(app)); } - return app.UseClaimsTransformation(options); + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } + + var options = new ClaimsTransformationOptions(); + configureOptions(options); + + return app.UseMiddleware(options); } } } diff --git a/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs b/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs index f8a4af52f0..c44a39360e 100644 --- a/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs @@ -11,17 +11,6 @@ namespace Microsoft.AspNet.Builder /// public static class CookiePolicyAppBuilderExtensions { - /// - /// Adds the middleware to the specified , which enables cookie policy capabilities. - /// - /// The to add the middleware to. - /// A that specifies options for the middleware. - /// A reference to this instance after the operation has completed. - public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options) - { - return app.UseMiddleware(options); - } - /// /// Adds the middleware to the specified , which enables cookie policy capabilities. /// @@ -30,12 +19,19 @@ namespace Microsoft.AspNet.Builder /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, Action configureOptions) { - var options = new CookiePolicyOptions(); - if (configureOptions != null) + if (app == null) { - configureOptions(options); + throw new ArgumentNullException(nameof(app)); } - return app.UseCookiePolicy(options); + if (configureOptions == null) + { + throw new ArgumentNullException(nameof(configureOptions)); + } + + var options = new CookiePolicyOptions(); + configureOptions(options); + + return app.UseMiddleware(options); } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Authentication.Test/Cookies/CookieMiddlewareTests.cs b/test/Microsoft.AspNet.Authentication.Test/Cookies/CookieMiddlewareTests.cs index db27680d42..852b63f3e0 100644 --- a/test/Microsoft.AspNet.Authentication.Test/Cookies/CookieMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Authentication.Test/Cookies/CookieMiddlewareTests.cs @@ -793,7 +793,7 @@ namespace Microsoft.AspNet.Authentication.Cookies .Configure(app => { app.UseCookieAuthentication(options => options.CookieName = "One"); - app.UseCookieAuthentication(new CookieAuthenticationOptions()); + app.UseCookieAuthentication(); app.Run(context => context.Authentication.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(new ClaimsIdentity()))); }) .ConfigureServices(services => services.AddAuthentication());