Skip to content

Commit

Permalink
Use Basic Auth for Sonarqube Onpremise (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyGis authored Dec 6, 2023
1 parent 51122ed commit a9656ee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions integrations/sonarqube/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

# Port_Ocean 0.1.17 (2023-12-06)

### Bug Fixes

- Corrected SonarQube On-Premise authentication to resolve 401 error codes previously experienced by users. This fix now properly utilizes Basic authentication (#17)


# Port_Ocean 0.1.16 (2023-12-05)

### Bug Fixes
Expand Down
9 changes: 7 additions & 2 deletions integrations/sonarqube/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Any, Optional, AsyncGenerator, cast

import base64
import httpx
from loguru import logger

Expand Down Expand Up @@ -48,9 +48,14 @@ def api_auth_params(self) -> dict[str, Any]:
"Content-Type": "application/json",
}
}

auth_message = f"{self.api_key}:"
auth_bytes = auth_message.encode("ascii")
b64_bytes = base64.b64encode(auth_bytes)
b64_message = b64_bytes.decode("ascii")
return {
"auth": (self.api_key, ""),
"headers": {
"Authorization": f"Basic {b64_message}",
"Content-Type": "application/json",
},
}
Expand Down
2 changes: 1 addition & 1 deletion integrations/sonarqube/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sonarqube"
version = "0.1.16"
version = "0.1.17"
description = "SonarQube projects and code quality analysis integration"
authors = ["Port Team <[email protected]>"]

Expand Down

0 comments on commit a9656ee

Please sign in to comment.