Skip to content

Commit 5ba8fae

Browse files
committed
fix auth in maven
1 parent 27d3097 commit 5ba8fae

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ pluginManagement {
3939
name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
4040
url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
4141

42-
val spaceUsername = getSpaceUsername()
4342
val spacePassword = getSpacePassword()
4443

45-
if (spaceUsername != null && spacePassword != null) {
46-
credentials {
47-
username = spaceUsername
48-
password = spacePassword
44+
if (spacePassword != null) {
45+
credentials(HttpHeaderCredentials::class.java) {
46+
name = "Authorization"
47+
value = "Bearer ${getSpacePassword()}"
48+
}
49+
50+
authentication {
51+
create<HttpHeaderAuthentication>("http_auth_header")
4952
}
5053
} else {
5154
logger.info("Skipping adding credentials for Space repository '$repoName'")
@@ -95,16 +98,18 @@ gradle.rootProject {
9598
fun RepositoryHandler.jbTeamPackages(repoName: String) {
9699
maven {
97100
name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
98-
99101
url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
100102

101-
val spaceUsername = getSpaceUsername()
102103
val spacePassword = getSpacePassword()
103104

104-
if (spaceUsername != null && spacePassword != null) {
105-
credentials {
106-
username = spaceUsername
107-
password = spacePassword
105+
if (spacePassword != null) {
106+
credentials(HttpHeaderCredentials::class.java) {
107+
name = "Authorization"
108+
value = "Bearer $spacePassword"
109+
}
110+
111+
authentication {
112+
create<HttpHeaderAuthentication>("http_auth_header")
108113
}
109114
} else {
110115
logger.info("Skipping adding credentials for Space repository '$repoName'")

0 commit comments

Comments
 (0)