Skip to content

Commit def5844

Browse files
@W-21933885: [MSDK Android] App Attestation Implementation (Automated Code Review #3. Over-exposed, unsynchronized, and semantically suspicious public API surface on SalesforceSDKManager + AppAttestationClient. c. updateAppAttestationClient likely uses the wrong host)
1 parent e98b26f commit def5844

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

libs/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,23 +251,24 @@ open class SalesforceSDKManager protected constructor(
251251
* for the app in Google Play Console's Play Integrity API and provided to
252252
* the Salesforce App Attestation External Client App Plugin.
253253
*
254-
* @param selectedLoginServerHost The selected login server configured with
255-
* the Salesforce App Attestation ECA Plugin
254+
* @param apiHostName The Salesforce App Attestation External Client App
255+
* (ECA) Plugin Challenge API Host Name. This usually matches the selected
256+
* login server
256257
* @param googleCloudProjectId The Google Cloud Project ID or null to
257258
* disable Salesforce App Attestation
258259
*/
259260
fun updateAppAttestationClient(
260-
selectedLoginServerHost: String,
261+
apiHostName: String,
261262
googleCloudProjectId: Long? = null
262263
) {
263264
synchronized(appAttestationClientLock) {
264265
appAttestationClient = googleCloudProjectId?.let { appAttestationGoogleCloudProjectId ->
265266
AppAttestationClient(
266267
context = appContext,
267-
apiHostName = selectedLoginServerHost,
268+
apiHostName = apiHostName,
268269
deviceId = deviceId,
269270
googleCloudProjectId = appAttestationGoogleCloudProjectId,
270-
remoteAccessConsumerKey = getBootConfig(getInstance().appContext).remoteAccessConsumerKey,
271+
remoteAccessConsumerKey = getBootConfig(appContext).remoteAccessConsumerKey,
271272
restClient = clientManager.peekUnauthenticatedRestClient()
272273
)
273274
}

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/SalesforceSDKManagerTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class SalesforceSDKManagerTests {
301301
)
302302

303303
salesforceSdkManager.updateAppAttestationClient(
304-
selectedLoginServerHost = "login.example.com",
304+
apiHostName = "login.example.com",
305305
googleCloudProjectId = 123456
306306
)
307307

0 commit comments

Comments
 (0)