-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,277 additions
and
191 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
ok-marketplace-acceptance/src/test/kotlin/docker/DebugDockerCompose.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package ru.otus.otuskotlin.marketplace.blackbox.docker | ||
|
||
import io.ktor.http.* | ||
import ru.otus.otuskotlin.marketplace.blackbox.fixture.docker.DockerCompose | ||
|
||
// для отладки тестов, предполагается, что докер-компоуз запущен вручную | ||
object DebugDockerCompose : DockerCompose { | ||
override fun start() { | ||
} | ||
|
||
override fun stop() { | ||
} | ||
|
||
override val inputUrl: URLBuilder | ||
get() = URLBuilder( | ||
protocol = URLProtocol.HTTP, | ||
host = "localhost", | ||
port = 8080, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
ok-marketplace-app-common/src/commonMain/kotlin/AuthConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ru.otus.otuskotlin.marketplace.app.common | ||
|
||
data class AuthConfig( | ||
val secret: String, | ||
val issuer: String, | ||
val audience: String, | ||
val realm: String, | ||
val clientId: String, | ||
val certUrl: String? = null, | ||
) { | ||
companion object { | ||
const val ID_CLAIM = "sub" | ||
const val GROUPS_CLAIM = "groups" | ||
const val F_NAME_CLAIM = "fname" | ||
const val M_NAME_CLAIM = "mname" | ||
const val L_NAME_CLAIM = "lname" | ||
|
||
val TEST = AuthConfig( | ||
secret = "secret", | ||
issuer = "OtusKotlin", | ||
audience = "ad-users", | ||
realm = "otus-marketplace", | ||
clientId = "otus-marketplace-service", | ||
) | ||
|
||
val NONE = AuthConfig( | ||
secret = "", | ||
issuer = "", | ||
audience = "", | ||
realm = "", | ||
clientId = "", | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
ok-marketplace-app-ktor/src/commonTest/kotlin/auth/authHelpers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ru.otus.otuskotlin.marketplace.app.auth | ||
|
||
import io.ktor.client.request.* | ||
import ru.otus.otuskotlin.marketplace.app.common.AuthConfig | ||
|
||
expect fun HttpRequestBuilder.addAuth( | ||
id: String = "user1", | ||
groups: List<String> = listOf("USER", "TEST"), | ||
config: AuthConfig = AuthConfig.TEST, | ||
) |
18 changes: 18 additions & 0 deletions
18
ok-marketplace-app-ktor/src/commonTest/kotlin/helpers/TestHelpers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ru.otus.otuskotlin.marketplace.app.helpers | ||
|
||
|
||
import ru.otus.otuskotlin.marketplace.app.common.AuthConfig | ||
import ru.otus.otuskotlin.marketplace.app.common.MkplAppSettings | ||
import ru.otus.otuskotlin.marketplace.backend.repository.inmemory.AdRepoStub | ||
import ru.otus.otuskotlin.marketplace.common.MkplCorSettings | ||
import ru.otus.otuskotlin.marketplace.common.repo.IAdRepository | ||
import ru.otus.otuskotlin.marketplace.repo.inmemory.AdRepoInMemory | ||
|
||
fun testSettings(repo: IAdRepository? = null) = MkplAppSettings( | ||
corSettings = MkplCorSettings( | ||
repoStub = AdRepoStub(), | ||
repoTest = repo ?: AdRepoInMemory(), | ||
repoProd = repo ?: AdRepoInMemory(), | ||
), | ||
auth = AuthConfig.TEST | ||
) |
Oops, something went wrong.