Skip to content

Commit

Permalink
[Antiforgery][Components][CORS] Remove obsolete APIs (dotnet#7459)
Browse files Browse the repository at this point in the history
  • Loading branch information
javiercn authored Feb 11, 2019
1 parent 58e6d78 commit dbf746d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 112 deletions.
64 changes: 0 additions & 64 deletions src/Antiforgery/src/AntiforgeryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,69 +82,5 @@ public string FormFieldName
/// the X-Frame-Options header will not be generated for the response.
/// </summary>
public bool SuppressXFrameOptionsHeader { get; set; }

#region Obsolete API
/// <summary>
/// <para>
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Name"/> on <see cref="Cookie"/>.
/// </para>
/// <para>
/// Specifies the name of the cookie that is used by the antiforgery system.
/// </para>
/// </summary>
/// <remarks>
/// If an explicit name is not provided, the system will automatically generate a
/// unique name that begins with <see cref="DefaultCookiePrefix"/>.
/// </remarks>
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Name) + ".")]
public string CookieName { get => Cookie.Name; set => Cookie.Name = value; }

/// <summary>
/// <para>
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Path"/> on <see cref="Cookie"/>.
/// </para>
/// <para>
/// The path set on the cookie. If set to <c>null</c>, the "path" attribute on the cookie is set to the current
/// request's <see cref="HttpRequest.PathBase"/> value. If the value of <see cref="HttpRequest.PathBase"/> is
/// <c>null</c> or empty, then the "path" attribute is set to the value of <see cref="CookieOptions.Path"/>.
/// </para>
/// </summary>
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Path) + ".")]
public PathString? CookiePath { get => Cookie.Path; set => Cookie.Path = value; }

/// <summary>
/// <para>
/// This property is obsolete and will be removed in a future version. The recommended alternative is <seealso cref="CookieBuilder.Domain"/> on <see cref="Cookie"/>.
/// </para>
/// <para>
/// The domain set on the cookie. By default its <c>null</c> which results in the "domain" attribute not being set.
/// </para>
/// </summary>
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Domain) + ".")]
public string CookieDomain { get => Cookie.Domain; set => Cookie.Domain = value; }


/// <summary>
/// <para>
/// This property is obsolete and will be removed in a future version.
/// The recommended alternative is to set <seealso cref="CookieBuilder.SecurePolicy"/> on <see cref="Cookie"/>.
/// </para>
/// <para>
/// <c>true</c> is equivalent to <see cref="CookieSecurePolicy.Always"/>.
/// <c>false</c> is equivalent to <see cref="CookieSecurePolicy.None"/>.
/// </para>
/// <para>
/// Specifies whether SSL is required for the antiforgery system
/// to operate. If this setting is 'true' and a non-SSL request
/// comes into the system, all antiforgery APIs will fail.
/// </para>
/// </summary>
[Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is to set " + nameof(Cookie) + "." + nameof(CookieBuilder.SecurePolicy) + ".")]
public bool RequireSsl
{
get => Cookie.SecurePolicy == CookieSecurePolicy.Always;
set => Cookie.SecurePolicy = value ? CookieSecurePolicy.Always : CookieSecurePolicy.None;
}
#endregion
}
}
8 changes: 4 additions & 4 deletions src/Antiforgery/test/Internal/DefaultAntiforgeryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public async Task ChecksSSL_ValidateRequestAsync_Throws()
var httpContext = GetHttpContext();
var options = new AntiforgeryOptions
{
#pragma warning disable CS0618
// obsolete property still forwards to correctly to the new API
RequireSsl = true
#pragma warning restore CS0618
Cookie = new CookieBuilder
{
SecurePolicy = CookieSecurePolicy.Always
}
};
var antiforgery = GetAntiforgery(httpContext, options);

Expand Down
34 changes: 0 additions & 34 deletions src/Components/Components/src/Json/JsonUtil.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/Middleware/CORS/src/Infrastructure/CorsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ public class CorsService : ICorsService
private readonly CorsOptions _options;
private readonly ILogger _logger;

/// <summary>
/// Creates a new instance of the <see cref="CorsService"/>.
/// </summary>
/// <param name="options">The option model representing <see cref="CorsOptions"/>.</param>
[Obsolete("This constructor is obsolete and will be removed in a future version.")]
public CorsService(IOptions<CorsOptions> options)
: this(options, loggerFactory: NullLoggerFactory.Instance)
{
}

/// <summary>
/// Creates a new instance of the <see cref="CorsService"/>.
/// </summary>
Expand Down

0 comments on commit dbf746d

Please sign in to comment.