Skip to content

Commit

Permalink
Merge pull request #28 from leanix/feature/CID-3000/Switch-from-app-n…
Browse files Browse the repository at this point in the history
…ame-to-slug

CID-3000: Switch from app name to slug
  • Loading branch information
alfredo-mfaria authored Oct 16, 2024
2 parents 4b170e0 + f9ab68c commit 7d0a6db
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty

@JsonIgnoreProperties(ignoreUnknown = true)
data class GitHubAppResponse(
@JsonProperty("name") val name: String,
@JsonProperty("slug") val slug: String,
@JsonProperty("permissions") val permissions: Map<String, String>,
@JsonProperty("events") val events: List<String>
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PostStartupRunner(
val jwt = cachingService.get("jwtToken") as String
webSocketService.sendMessage(
APP_NAME_TOPIC,
gitHubEnterpriseService.getGitHubApp(jwt).name
gitHubEnterpriseService.getGitHubApp(jwt).slug
)
gitHubScanningService.scanGitHubResources()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GitHubEnterpriseService(private val githubClient: GitHubClient) {
runCatching {
val githubApp = getGitHubApp(jwt)
validateGithubAppResponse(githubApp)
logger.info("Authenticated as GitHub App: '${githubApp.name}'")
logger.info("Authenticated as GitHub App: '${githubApp.slug}'")
}.onFailure {
logger.error("Failed to verify JWT token", it)
when (it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class GitHubEnterpriseServiceTest {
fun `verifyJwt with valid jwt should not throw exception`() {
val jwt = "validJwt"
val githubApp = GitHubAppResponse(
name = "validApp",
slug = "validApp",
permissions = mapOf("administration" to "read", "contents" to "read", "metadata" to "read"),
events = listOf("label", "public", "repository")
)
Expand All @@ -39,7 +39,7 @@ class GitHubEnterpriseServiceTest {
@Test
fun `validateGithubAppResponse with correct permissions should not throw exception`() {
val response = GitHubAppResponse(
name = "validApp",
slug = "validApp",
permissions = mapOf("administration" to "read", "contents" to "read", "metadata" to "read"),
events = listOf("label", "public", "repository")
)
Expand All @@ -50,7 +50,7 @@ class GitHubEnterpriseServiceTest {
@Test
fun `validateGithubAppResponse with missing permissions should throw exception`() {
val response = GitHubAppResponse(
name = "validApp",
slug = "validApp",
permissions = mapOf("administration" to "read", "contents" to "read"),
events = listOf("label", "public", "repository")
)
Expand All @@ -63,7 +63,7 @@ class GitHubEnterpriseServiceTest {
@Test
fun `validateGithubAppResponse with missing events should throw exception`() {
val response = GitHubAppResponse(
name = "validApp",
slug = "validApp",
permissions = mapOf("administration" to "read", "contents" to "read", "metadata" to "read"),
events = listOf("label", "public")
)
Expand Down

0 comments on commit 7d0a6db

Please sign in to comment.