-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono.Android] Optional NTLMv2 support in AndroidMessageHandler (#6999)
Context: dotnet/runtime#62264 Context? https://github.com/wfurt/Ntlm Update `Xamarin.Android.Net.AndroidMessageHandler` to *optionally* support NTLMv2 authentication in .NET 7+. This authentication method is recommended only for legacy services that do not provide any more secure options. If an endpoint requires NTLMv2 authentication and NTMLv2 is not enabled, then the endpoint will return HTTP-401 errors. NTLMv2 authentication can be enabled by setting the `$(AndroidUseNegotiateAuthentication)` MSBuild property to True. If this property is False or isn't set, then NTLMv2 support is linked away during the package build. Example `.csproj` changes to enable NTLMv2 support: <PropertyGroup> <AndroidUseNegotiateAuthentication>true</AndroidUseNegotiateAuthentication> </PropertyGroup> Example C# `HttpClient` usage using NTLMv2 authentication: var cache = new CredentialCache (); cache.Add (serverUri, "Negotiate", new NetworkCredential(username, password, domain)); var handler = new AndroidMessageHandler { Credentials = cache, }; var client = new HttpClient (handler); var response = await client.GetAsync (requestUri); // 200 OK; 401 is NTLMv2 isn't enabled
- Loading branch information
1 parent
d26e69a
commit f348163
Showing
11 changed files
with
480 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.