cuba-platform / cuba-gradle-plugin

Gradle plugin for building CUBA platform and applications
https://www.cuba-platform.com
Apache License 2.0
15 stars 18 forks source link

Header authentication not sent for appComponent dependencies #162

Open Charrey opened 1 year ago

Charrey commented 1 year ago

Environment

Description of the bug or enhancement

When fetching appComponents from a Maven repository that uses HTTP header authentication (such as Gitlab) the header and header value specified in the CUBA project's build.gradle are ignored.

Minimal reproducible example

Take the following cuba project: minimalexample.zip

Open a request bin on localhost port 1234 or change the secondary repository to a remote requestbin. Then sync the gradle project / run gradle build.

Expected behavior

A header is included with the name authorization-header and value very-secret-authorization-token

Actual behavior

No such header is included

Fix

In CubaPlugin.groovy replace the following code:

172 maven {
173     url mavenRepo.url
174     credentials(HttpHeaderCredentials) {
175         name(httpHeaderCredentials.name ?: '')
176         value(httpHeaderCredentials.value ?: '')
177     }
178 }

by this code:

maven {
    url mavenRepo.url
    credentials(HttpHeaderCredentials) {
         name(httpHeaderCredentials.name ?: '')
         value(httpHeaderCredentials.value ?: '')
     }
     authentication {
         header(HttpHeaderAuthentication)
     }
 }