Skip to content

[net] Make authentication modules trimmable - #12791

Open
simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-trim-auth-modules
Open

simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-trim-auth-modules

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Summary

  • Delay creation of the built-in Basic and Digest authentication modules until PreAuthenticationData is configured.
  • Allow AuthModuleBasic, AuthModuleDigest, AuthDigestSession, and AuthDigestHeaderParser to be trimmed from apps that do not use pre-authentication.

Verification

  • Rebuilt the local SDK with make all.
  • Built a fully trimmed Release app using AndroidMessageHandler without PreAuthenticationData and inspected the linked Mono.Android.dll to confirm the implementation types were removed.

Delay creation of the built-in Basic and Digest authentication modules until PreAuthenticationData is configured, allowing unused implementations to be removed by the linker.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add regression coverage for Basic/Digest authentication with configured pre-authentication data.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Defers built-in Basic and Digest authentication module creation so unused implementations can be trimmed.

Changes:

  • Lazily initializes authentication modules when pre-authentication is configured.
  • Updates authentication lookup for uninitialized module storage.
File Summary
src/​Mono.Android/​Xamarin.Android.Net/​AndroidMessageHandler.cs Implements lazy authentication module initialization and lookup. Review noted missing Basic/Digest regression coverage.

Comment on lines +762 to +766
if (value != null && authModules == null) {
authModules = [
new AuthModuleBasic (),
new AuthModuleDigest ()
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants