Skip to content

Is AuthenticationManager obsolete #77459

@yul-zhou

Description

@yul-zhou

Edited by @MihaZupan to add the proposed obsoletion changes to the API.

The AuthenticationManager class currently has Obsolete annotations on two of its methods, where the rest of them are no-ops.

public partial class AuthenticationManager
{
    internal AuthenticationManager() { }

    // You can get/set these, but nothing else will consume them.
    public static System.Net.ICredentialPolicy? CredentialPolicy { get { throw null; } set { } }
    public static System.Collections.Specialized.StringDictionary CustomTargetNameDictionary { get { throw null; } }

    // These are no-op
    public static System.Collections.IEnumerator RegisteredModules { get { throw null; } }
    public static void Register(System.Net.IAuthenticationModule authenticationModule) { }
    public static void Unregister(System.Net.IAuthenticationModule authenticationModule) { }
    public static void Unregister(string authenticationScheme) { }

    // These are marked as Obsolete and throw PlatformNotSupportedException
    [System.ObsoleteAttribute("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId = "SYSLIB0009", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
    public static System.Net.Authorization? Authenticate(string challenge, System.Net.WebRequest request, System.Net.ICredentials credentials) { throw null; }
    [System.ObsoleteAttribute("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId = "SYSLIB0009", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
    public static System.Net.Authorization? PreAuthenticate(System.Net.WebRequest request, System.Net.ICredentials credentials) { throw null; }
}

I propose we move the [Obsolete] annotation to the whole class.
We can use the existing diagnostic ID and update the message.

[System.ObsoleteAttribute(
    "AuthenticationManager is not supported. Methods will no-op or throw PlatformNotSupportedException.",
    DiagnosticId = "SYSLIB0009",
    UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial class AuthenticationManager

Original post

Package Id

System.Net.AuthenticationManager

Package Version(s)

.Net 6

Additional details

I am not quite sure if this is the right place to ask this question. Please redirect me to the right place if I am wrong.

So, when I tried out System.Net.AuthenticationManager Class, .Net Core 6 shows different behaviors with .Net Framework 4.8. The RegisteredModules properties are empty by default in .Net Core 6 and even I register a new module, it is still empty. So have System.Net.AuthenticationManager already been deprecated?

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.NetdocumentationDocumentation bug or enhancement, does not impact product or test code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions