apache / apache/maven-resolver

[MRESOLVER-495] Provide AuthenticationSelector based on host/realm instead of repository id

Open
#1,167 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
152
Forks
160
Avg merge
1d 4h
Merged PRs (30d)
49

Description

**[Konrad Windszus](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kwin)** opened **[MRESOLVER-495](https://issues.apache.org/jira/browse/MRESOLVER-495?redirect=false)** and commented

Currently the [`DefaultAuthenticationSelector`](https://github.com/apache/maven-resolver/blob/master/maven-resolver-util/src/main/java/org/eclipse/aether/util/repository/DefaultAuthenticationSelector.java#L56) only returns authentication info based on the repository id. In order to reuse the same authentication for multiple repositories (on the same or even on different servers) it should be possible to add authentication for a host (and potentially port/realm/scheme).

Apache HttpClient uses the `AuthScope` class (https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/auth/AuthScope.html) to bind credentials to requests.

Compare with https://datatracker.ietf.org/doc/html/rfc7235#section-2.2.

---

**Issue Links:**
- [MNG-6895](https://issues.apache.org/jira/browse/MNG-6895) Add aliasing feature for settings.xml:///servers/server

- [MNG-5585](https://issues.apache.org/jira/browse/MNG-5585) match server credentials based on server realm

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with maven-resolver-util/src/main/java/org/eclipse/aether/util/repository/DefaultAuthenticationSelector.java and review how authentication is currently selected by repository id. Compare the desired matching scope with Apache HttpClient's AuthScope and RFC 7235 section 2.2. Done should allow authentication reuse across repositories using host and potentially port, realm, and scheme while preserving the existing selection behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.