Skip to content

Commit d1ee5a2

Browse files
authored
Remove obsolete apis (#1915)
1 parent 7e14b05 commit d1ee5a2

File tree

7 files changed

+82
-116
lines changed

7 files changed

+82
-116
lines changed

src/Microsoft.AspNetCore.Authentication.Cookies/CookieAuthenticationOptions.cs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -147,68 +147,5 @@ public CookieBuilder Cookie
147147
/// </para>
148148
/// </summary>
149149
public TimeSpan ExpireTimeSpan { get; set; }
150-
151-
#region Obsolete API
152-
/// <summary>
153-
/// <para>
154-
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Name"/> on <see cref="Cookie"/>.
155-
/// </para>
156-
/// <para>
157-
/// Determines the cookie name used to persist the identity. The default value is ".AspNetCore.Cookies".
158-
/// This value should be changed if you change the name of the AuthenticationScheme, especially if your
159-
/// system uses the cookie authentication handler multiple times.
160-
/// </para>
161-
/// </summary>
162-
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Name) + ".")]
163-
public string CookieName { get => Cookie.Name; set => Cookie.Name = value; }
164-
165-
/// <summary>
166-
/// <para>
167-
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Domain"/> on <see cref="Cookie"/>.
168-
/// </para>
169-
/// <para>
170-
/// Determines the domain used to create the cookie. Is not provided by default.
171-
/// </para>
172-
/// </summary>
173-
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Domain) + ".")]
174-
public string CookieDomain { get => Cookie.Domain; set => Cookie.Domain = value; }
175-
176-
/// <summary>
177-
/// <para>
178-
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Path"/> on <see cref="Cookie"/>.
179-
/// </para>
180-
/// <para>
181-
/// Determines the path used to create the cookie. The default value is "/" for highest browser compatibility.
182-
/// </para>
183-
/// </summary>
184-
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Path) + ".")]
185-
public string CookiePath { get => Cookie.Path; set => Cookie.Path = value; }
186-
187-
/// <summary>
188-
/// <para>
189-
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.HttpOnly"/> on <see cref="Cookie"/>.
190-
/// </para>
191-
/// <para>
192-
/// Determines if the browser should allow the cookie to be accessed by client-side javascript. The
193-
/// default is true, which means the cookie will only be passed to http requests and is not made available
194-
/// to script on the page.
195-
/// </para>
196-
/// </summary>
197-
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.HttpOnly) + ".")]
198-
public bool CookieHttpOnly { get => Cookie.HttpOnly; set => Cookie.HttpOnly = value; }
199-
200-
/// <summary>
201-
/// <para>
202-
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.SecurePolicy"/> on <see cref="Cookie"/>.
203-
/// </para>
204-
/// <para>
205-
/// Determines if the cookie should only be transmitted on HTTPS request. The default is to limit the cookie
206-
/// to HTTPS requests if the page which is doing the SignIn is also HTTPS. If you have an HTTPS sign in page
207-
/// and portions of your site are HTTP you may need to change this value.
208-
/// </para>
209-
/// </summary>
210-
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.SecurePolicy) + ".")]
211-
public CookieSecurePolicy CookieSecure { get => Cookie.SecurePolicy; set => Cookie.SecurePolicy = value; }
212-
#endregion
213150
}
214151
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[
2+
{
3+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
4+
"MemberId": "public Microsoft.AspNetCore.Http.CookieSecurePolicy get_CookieSecure()",
5+
"Kind": "Removal"
6+
},
7+
{
8+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
9+
"MemberId": "public System.Boolean get_CookieHttpOnly()",
10+
"Kind": "Removal"
11+
},
12+
{
13+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
14+
"MemberId": "public System.String get_CookieDomain()",
15+
"Kind": "Removal"
16+
},
17+
{
18+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
19+
"MemberId": "public System.String get_CookieName()",
20+
"Kind": "Removal"
21+
},
22+
{
23+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
24+
"MemberId": "public System.String get_CookiePath()",
25+
"Kind": "Removal"
26+
},
27+
{
28+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
29+
"MemberId": "public System.Void set_CookieDomain(System.String value)",
30+
"Kind": "Removal"
31+
},
32+
{
33+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
34+
"MemberId": "public System.Void set_CookieHttpOnly(System.Boolean value)",
35+
"Kind": "Removal"
36+
},
37+
{
38+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
39+
"MemberId": "public System.Void set_CookieName(System.String value)",
40+
"Kind": "Removal"
41+
},
42+
{
43+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
44+
"MemberId": "public System.Void set_CookiePath(System.String value)",
45+
"Kind": "Removal"
46+
},
47+
{
48+
"TypeId": "public class Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions",
49+
"MemberId": "public System.Void set_CookieSecure(Microsoft.AspNetCore.Http.CookieSecurePolicy value)",
50+
"Kind": "Removal"
51+
}
52+
]

src/Microsoft.AspNetCore.Authentication.JwtBearer/JwtBearerHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class JwtBearerHandler : AuthenticationHandler<JwtBearerOptions>
2222
{
2323
private OpenIdConnectConfiguration _configuration;
2424

25-
public JwtBearerHandler(IOptionsMonitor<JwtBearerOptions> options, ILoggerFactory logger, UrlEncoder encoder, IDataProtectionProvider dataProtection, ISystemClock clock)
25+
public JwtBearerHandler(IOptionsMonitor<JwtBearerOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock)
2626
: base(options, logger, encoder, clock)
2727
{ }
2828

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"TypeId": "public class Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler : Microsoft.AspNetCore.Authentication.AuthenticationHandler<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions>",
4+
"MemberId": "public .ctor(Microsoft.Extensions.Options.IOptionsMonitor<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> options, Microsoft.Extensions.Logging.ILoggerFactory logger, System.Text.Encodings.Web.UrlEncoder encoder, Microsoft.AspNetCore.DataProtection.IDataProtectionProvider dataProtection, Microsoft.AspNetCore.Authentication.ISystemClock clock)",
5+
"Kind": "Removal"
6+
}
7+
]

src/Microsoft.AspNetCore.Authentication/AuthenticationServiceCollectionExtensions.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,48 +46,6 @@ public static AuthenticationBuilder AddAuthentication(this IServiceCollection se
4646
return builder;
4747
}
4848

49-
[Obsolete("AddScheme is obsolete. Use AddAuthentication().AddScheme instead.")]
50-
public static IServiceCollection AddScheme<TOptions, THandler>(this IServiceCollection services, string authenticationScheme, string displayName, Action<AuthenticationSchemeBuilder> configureScheme, Action<TOptions> configureOptions)
51-
where TOptions : AuthenticationSchemeOptions, new()
52-
where THandler : AuthenticationHandler<TOptions>
53-
{
54-
services.AddAuthentication(o =>
55-
{
56-
o.AddScheme(authenticationScheme, scheme => {
57-
scheme.HandlerType = typeof(THandler);
58-
scheme.DisplayName = displayName;
59-
configureScheme?.Invoke(scheme);
60-
});
61-
});
62-
if (configureOptions != null)
63-
{
64-
services.Configure(authenticationScheme, configureOptions);
65-
}
66-
services.AddTransient<THandler>();
67-
return services;
68-
}
69-
70-
[Obsolete("AddScheme is obsolete. Use AddAuthentication().AddScheme instead.")]
71-
public static IServiceCollection AddScheme<TOptions, THandler>(this IServiceCollection services, string authenticationScheme, Action<TOptions> configureOptions)
72-
where TOptions : AuthenticationSchemeOptions, new()
73-
where THandler : AuthenticationHandler<TOptions>
74-
=> services.AddScheme<TOptions, THandler>(authenticationScheme, displayName: null, configureScheme: null, configureOptions: configureOptions);
75-
76-
[Obsolete("AddScheme is obsolete. Use AddAuthentication().AddScheme instead.")]
77-
public static IServiceCollection AddScheme<TOptions, THandler>(this IServiceCollection services, string authenticationScheme, string displayName, Action<TOptions> configureOptions)
78-
where TOptions : AuthenticationSchemeOptions, new()
79-
where THandler : AuthenticationHandler<TOptions>
80-
=> services.AddScheme<TOptions, THandler>(authenticationScheme, displayName, configureScheme: null, configureOptions: configureOptions);
81-
82-
[Obsolete("AddScheme is obsolete. Use AddAuthentication().AddScheme instead.")]
83-
public static IServiceCollection AddRemoteScheme<TOptions, THandler>(this IServiceCollection services, string authenticationScheme, string displayName, Action<TOptions> configureOptions)
84-
where TOptions : RemoteAuthenticationOptions, new()
85-
where THandler : RemoteAuthenticationHandler<TOptions>
86-
{
87-
services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, EnsureSignInScheme<TOptions>>());
88-
return services.AddScheme<TOptions, THandler>(authenticationScheme, displayName, configureScheme: null, configureOptions: configureOptions);
89-
}
90-
9149
// Used to ensure that there's always a sign in scheme
9250
private class EnsureSignInScheme<TOptions> : IPostConfigureOptions<TOptions> where TOptions : RemoteAuthenticationOptions
9351
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"TypeId": "public static class Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions",
4+
"MemberId": "public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddRemoteScheme<T0, T1>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.String authenticationScheme, System.String displayName, System.Action<T0> configureOptions) where T0 : Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions, new() where T1 : Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<T0>",
5+
"Kind": "Removal"
6+
},
7+
{
8+
"TypeId": "public static class Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions",
9+
"MemberId": "public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScheme<T0, T1>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.String authenticationScheme, System.Action<T0> configureOptions) where T0 : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions, new() where T1 : Microsoft.AspNetCore.Authentication.AuthenticationHandler<T0>",
10+
"Kind": "Removal"
11+
},
12+
{
13+
"TypeId": "public static class Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions",
14+
"MemberId": "public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScheme<T0, T1>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.String authenticationScheme, System.String displayName, System.Action<Microsoft.AspNetCore.Authentication.AuthenticationSchemeBuilder> configureScheme, System.Action<T0> configureOptions) where T0 : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions, new() where T1 : Microsoft.AspNetCore.Authentication.AuthenticationHandler<T0>",
15+
"Kind": "Removal"
16+
},
17+
{
18+
"TypeId": "public static class Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions",
19+
"MemberId": "public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScheme<T0, T1>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.String authenticationScheme, System.String displayName, System.Action<T0> configureOptions) where T0 : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions, new() where T1 : Microsoft.AspNetCore.Authentication.AuthenticationHandler<T0>",
20+
"Kind": "Removal"
21+
}
22+
]

src/Microsoft.AspNetCore.Authorization/AuthorizeAttribute.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,5 @@ public AuthorizeAttribute(string policy)
3939
/// Gets or sets a comma delimited list of schemes from which user information is constructed.
4040
/// </summary>
4141
public string AuthenticationSchemes { get; set; }
42-
43-
/// <summary>
44-
/// Gets or sets a comma delimited list of schemes from which user information is constructed.
45-
/// </summary>
46-
[Obsolete("Use AuthenticationSchemes instead.", error: false)]
47-
public string ActiveAuthenticationSchemes
48-
{
49-
get => AuthenticationSchemes;
50-
set => AuthenticationSchemes = value;
51-
}
5242
}
5343
}

0 commit comments

Comments
 (0)