mirror of
https://github.com/bitwarden/android.git
synced 2026-03-09 03:33:36 -05:00
[PM-31954] Add server communication models to ConfigResponseJson (#6500)
This commit is contained in:
@@ -7710,6 +7710,7 @@ class AuthRepositoryTest {
|
||||
ssoUrl = "mockSsoUrl",
|
||||
),
|
||||
featureStates = emptyMap(),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -324,5 +324,6 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"dummy-boolean" to JsonPrimitive(true),
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -54,5 +54,6 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
"dummy-boolean" to JsonPrimitive(true),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -267,5 +267,6 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"dummy-boolean" to JsonPrimitive(true),
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -54,5 +54,6 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
"dummy-boolean" to JsonPrimitive(true),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -111,5 +111,6 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"duo-redirect" to JsonPrimitive(true),
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -166,6 +166,7 @@ private val SERVER_CONFIG = ServerConfig(
|
||||
"duo-redirect" to JsonPrimitive(true),
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
),
|
||||
communication = null,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -189,4 +190,5 @@ private val CONFIG_RESPONSE_JSON = ConfigResponseJson(
|
||||
"duo-redirect" to JsonPrimitive(true),
|
||||
"flexible-collections-v-1" to JsonPrimitive(false),
|
||||
),
|
||||
communication = null,
|
||||
)
|
||||
|
||||
@@ -13,6 +13,7 @@ import kotlinx.serialization.json.JsonPrimitive
|
||||
* @property server The server information (nullable).
|
||||
* @property environment The environment information containing URLs (vault, api, identity, etc.).
|
||||
* @property featureStates A map containing various feature states.
|
||||
* @property communication The communication configuration for server bootstrap (nullable).
|
||||
*/
|
||||
@Serializable
|
||||
data class ConfigResponseJson(
|
||||
@@ -33,6 +34,9 @@ data class ConfigResponseJson(
|
||||
|
||||
@SerialName("featureStates")
|
||||
val featureStates: Map<String, JsonPrimitive>?,
|
||||
|
||||
@SerialName("communication")
|
||||
val communication: CommunicationJson?,
|
||||
) {
|
||||
/**
|
||||
* Represents a server in the configuration response.
|
||||
@@ -79,4 +83,38 @@ data class ConfigResponseJson(
|
||||
@SerialName("sso")
|
||||
val ssoUrl: String?,
|
||||
)
|
||||
|
||||
/**
|
||||
* Represents the communication configuration in the configuration response.
|
||||
*
|
||||
* @param bootstrap The bootstrap configuration for server communication (nullable).
|
||||
*/
|
||||
@Serializable
|
||||
data class CommunicationJson(
|
||||
@SerialName("bootstrap")
|
||||
val bootstrap: BootstrapJson,
|
||||
) {
|
||||
/**
|
||||
* Represents the bootstrap configuration for SSO cookie vendor authentication.
|
||||
*
|
||||
* @param type The type of bootstrap configuration (e.g., "ssoCookieVendor").
|
||||
* @param idpLoginUrl The URL of the identity provider login page.
|
||||
* @param cookieName The name of the authentication cookie.
|
||||
* @param cookieDomain The domain for which the cookie is valid.
|
||||
*/
|
||||
@Serializable
|
||||
data class BootstrapJson(
|
||||
@SerialName("type")
|
||||
val type: String,
|
||||
|
||||
@SerialName("idpLoginUrl")
|
||||
val idpLoginUrl: String?,
|
||||
|
||||
@SerialName("cookieName")
|
||||
val cookieName: String?,
|
||||
|
||||
@SerialName("cookieDomain")
|
||||
val cookieDomain: String?,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ private const val CONFIG_RESPONSE_JSON = """
|
||||
},
|
||||
"featureStates": {
|
||||
"feature one": false
|
||||
},
|
||||
"communication": {
|
||||
"bootstrap": {
|
||||
"type": "ssoCookieVendor",
|
||||
"idpLoginUrl": "https://idp.example.com/login",
|
||||
"cookieName": "sso-cookie",
|
||||
"cookieDomain": ".example.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -64,4 +72,12 @@ private val CONFIG_RESPONSE = ConfigResponseJson(
|
||||
featureStates = mapOf(
|
||||
"feature one" to JsonPrimitive(false),
|
||||
),
|
||||
communication = ConfigResponseJson.CommunicationJson(
|
||||
bootstrap = ConfigResponseJson.CommunicationJson.BootstrapJson(
|
||||
type = "ssoCookieVendor",
|
||||
idpLoginUrl = "https://idp.example.com/login",
|
||||
cookieName = "sso-cookie",
|
||||
cookieDomain = ".example.com",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user