cstamas opened a new pull request, #14173:
URL: https://github.com/apache/maven/pull/14173

   Maven Resolver 2.0.27 adds bearer token authentication 
(apache/maven-resolver#2372): HTTP transports (except Wagon) send it 
preemptively as an `Authorization: Bearer` header, and it takes precedence over 
username and password. This PR exposes it in `settings.xml`:
   
   ```xml
   <server>
     <id>internal</id>
     <bearerToken>...</bearerToken>
   </server>
   ```
   
   Changes:
   - Settings model **1.4.0** with the new `bearerToken` field on `<server>` 
(1.3.0 already shipped in 3.10.0). The sample `conf/settings.xml` now uses the 
1.4.0 namespace, as it was still on 1.2.0, and shows a token example.
   - `DefaultSettingsDecrypter` decrypts the token like the password and 
passphrase. The session factory warns when a token is left encrypted.
   - `DefaultRepositorySystemSessionFactory` hands the token to the resolver 
via `AuthenticationBuilder.addBearerToken`.
   - **Older plugin path:** the `maven-artifact` `Authentication` gets a 
`bearerToken` field. `MavenRepositorySystem`, `LegacyRepositorySystem` and 
`RepositoryUtils.toAuthentication` carry it, so plugins converting 
`ArtifactRepository` ↔ `RemoteRepository` keep it.
   - `DefaultSettingsValidator` warns when a token is set together with a 
username or password, since those are ignored.
   - The Wagon transport is left as is and ignores the token.
   
   **Depends on:** apache/maven-resolver#2372. `resolverVersion` is set to 
`2.0.27-SNAPSHOT`, so CI cannot build this until the resolver change is 
deployed. Switch to 2.0.27 once it is released.
   
   Release note: `settings-1.4.0.xsd` must be published to maven.apache.org/xsd.
   
   Tests: a new `DefaultSettingsDecrypterTest`, plus new cases in 
`DefaultSettingsValidatorTest`, `DefaultRepositorySystemSessionFactoryTest` 
(settings → session → `ArtifactRepository` → `toRepo`) and 
`LegacyRepositorySystemTest`. `mvn verify` passes locally on the touched 
modules (656 tests) against a locally installed resolver snapshot.
   
   - [x] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to