Skip to content

Commit dbfcde5

Browse files
committed
Remove vendor and identity provider code properties
- Eliminated `vendor` from `CsmPlatformProperties` and related configurations. - Removed `identityProvider.code` from platform properties and associated usages in tests, configs, and runtime environments. - Refactored environment profiles.
1 parent 79a3772 commit dbfcde5

File tree

6 files changed

+6
-44
lines changed

6 files changed

+6
-44
lines changed

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,6 @@ subprojects {
529529
tasks.getByName<BootRun>("bootRun") {
530530
workingDir = rootDir
531531

532-
environment("CSM_PLATFORM_VENDOR", project.findProperty("platform")?.toString() ?: "")
533-
project.findProperty("identityProvider")?.toString()?.let {
534-
environment("IDENTITY_PROVIDER", it)
535-
}
536-
537532
if (project.hasProperty("jvmArgs")) {
538533
jvmArgs = project.property("jvmArgs").toString().split("\\s+".toRegex()).toList()
539534
}

common/src/main/kotlin/com/cosmotech/common/config/CsmApiConfiguration.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license.
33
package com.cosmotech.common.config
44

5-
import com.cosmotech.common.config.CsmPlatformProperties.Vendor.ON_PREMISE
65
import com.cosmotech.common.utils.yamlObjectMapper
76
import com.fasterxml.jackson.databind.ObjectMapper
87
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
@@ -50,13 +49,10 @@ open class CsmPlatformEnvironmentPostProcessor : EnvironmentPostProcessor {
5049
environment: ConfigurableEnvironment,
5150
application: SpringApplication
5251
) {
53-
val platform = (System.getenv("CSM_PLATFORM_VENDOR") ?: ON_PREMISE.toString()).lowercase()
54-
addSpringProfile(platform, environment)
55-
val identityProvider = (System.getenv("IDENTITY_PROVIDER") ?: "keycloak")
56-
addSpringProfile(identityProvider, environment)
52+
addSpringProfile(environment)
5753
}
5854

59-
private fun addSpringProfile(profile: String, environment: ConfigurableEnvironment) {
55+
private fun addSpringProfile(environment: ConfigurableEnvironment, profile: String = "keycloak") {
6056
if (profile.isNotBlank()) {
6157
if (environment.activeProfiles.none { profile.equals(it, ignoreCase = true) }) {
6258
log.debug("Adding '$profile' as an active profile")

common/src/main/kotlin/com/cosmotech/common/config/CsmPlatformProperties.kt

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ data class CsmPlatformProperties(
1212
/** API Configuration */
1313
val api: Api,
1414

15-
/** Platform vendor */
16-
val vendor: Vendor = Vendor.ON_PREMISE,
17-
1815
/** Id Generator */
1916
val idGenerator: IdGenerator,
2017

@@ -33,10 +30,7 @@ data class CsmPlatformProperties(
3330
/** Authorization Configuration */
3431
val authorization: Authorization = Authorization(),
3532

36-
/**
37-
* Identity provider used for (Entra ID ,Okta, Keycloak) if openapi default configuration needs
38-
* to be overwritten
39-
*/
33+
/** Identity provider used if openapi default configuration needs to be overwritten */
4034
val identityProvider: CsmIdentityProvider,
4135

4236
/** Twin Data Layer configuration */
@@ -296,33 +290,14 @@ data class CsmPlatformProperties(
296290
val password: String? = null,
297291
)
298292

299-
enum class Vendor {
300-
/** Microsoft Azure : https://azure.microsoft.com/en-us/ */
301-
AZURE,
302-
ON_PREMISE
303-
}
304-
305293
data class CsmIdentityProvider(
306-
/** okta|azure|keycloak */
307-
val code: String,
308-
309-
/**
310-
* entry sample :
311-
* - {"http://dev.api.cosmotech.com/platform" to "Platform scope"}
312-
* - {"default" to "Default scope"}
313-
*/
294+
/** Scopes */
314295
val defaultScopes: Map<String, String> = emptyMap(),
315296

316-
/**
317-
* - "https://{yourOktaDomain}/oauth2/default/v1/authorize"
318-
* - "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
319-
*/
297+
/** Authorization URL */
320298
val authorizationUrl: String,
321299

322-
/**
323-
* - "https://{yourOktaDomain}/oauth2/default/v1/token"
324-
* - "https://login.microsoftonline.com/common/oauth2/v2.0/token"
325-
*/
300+
/** Token URL */
326301
val tokenUrl: String,
327302

328303
/**

common/src/test/kotlin/com/cosmotech/common/rbac/CsmRbacTests.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class CsmRbacTests {
8080

8181
private val DEFAULT_IDENTITY_PROVIDER =
8282
CsmPlatformProperties.CsmIdentityProvider(
83-
"identityProviderCode",
8483
authorizationUrl = "http://my-fake-authorization.url/autorize",
8584
tokenUrl = "http://my-fake-token.url/token",
8685
adminGroup = CUSTOM_ADMIN_GROUP,

run/src/main/kotlin/com/cosmotech/run/RunContainerFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ internal fun getMinimalCommonEnvVars(
330330
val containerScopes = getContainerScopes(csmPlatformProperties)
331331
val commonEnvVars =
332332
mapOf(
333-
IDENTITY_PROVIDER to (csmPlatformProperties.identityProvider.code),
334333
IDP_TENANT_ID to csmPlatformProperties.identityProvider.identity.tenantId,
335334
IDP_CLIENT_ID to csmPlatformProperties.identityProvider.identity.clientId,
336335
IDP_CLIENT_SECRET to csmPlatformProperties.identityProvider.identity.clientSecret,

run/src/test/kotlin/com/cosmotech/run/ContainerFactoryTests.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class ContainerFactoryTests {
7777
)
7878
every { csmPlatformProperties.identityProvider } returns
7979
CsmPlatformProperties.CsmIdentityProvider(
80-
code = "keycloak",
8180
defaultScopes = mapOf("This is a fake scope id" to "This is a fake scope name"),
8281
authorizationUrl = "http://this_is_a_fake_url.com",
8382
tokenUrl = "http://this_is_a_fake_token_url.com",
@@ -185,7 +184,6 @@ class ContainerFactoryTests {
185184
image = "twinengines.azurecr.io/" + solution.repository + ":" + solution.version,
186185
envVars =
187186
mapOf(
188-
"IDENTITY_PROVIDER" to "keycloak",
189187
"CSM_API_SCOPE" to "/.default",
190188
"CSM_API_URL" to csmPlatformProperties.api.baseUrl,
191189
"CSM_DATASET_ABSOLUTE_PATH" to "/mnt/scenariorun-data",

0 commit comments

Comments
 (0)