Skip to content

Commit c4f4499

Browse files
@W-21933885: [MSDK Android] App Attestation Implementation (Resolve To-Dos)
1 parent 7edf826 commit c4f4499

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ open class SalesforceSDKManager protected constructor(
242242
set(value) {
243243
field = value
244244

245-
val loginHost = loginServerManager.selectedLoginServer.url.toUri().host
245+
val loginHost = loginServerManager.selectedLoginServer?.url?.toUri()?.host
246246
if (loginHost == null) {
247247
w(javaClass.name, "Cannot initialize Salesforce App Attestation Client since the selected login server URL doesn't have a host. Authentication may malfunction.")
248248
return

libs/SalesforceSDK/src/com/salesforce/androidsdk/auth/NativeLoginManager.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,11 @@ internal class NativeLoginManager(
190190

191191
@VisibleForTesting
192192
internal fun isValidPassword(password: String): Boolean {
193-
// TODO: Revert this change after testing with administrator-created accounts that have non-compliant passwords. ECJ20260312
194-
// val containsNumber = password.contains("[0-9]".toRegex())
195-
// val containsLetter = password.contains("[A-Za-z]".toRegex())
193+
val containsNumber = password.contains("[0-9]".toRegex())
194+
val containsLetter = password.contains("[A-Za-z]".toRegex())
196195

197-
// return containsNumber && containsLetter && password.length >= MIN_PASSWORD_LENGTH
198-
// && password.toByteArray().size <= MAX_PASSWORD_LENGTH_BYTES
199-
return true
196+
return containsNumber && containsLetter && password.length >= MIN_PASSWORD_LENGTH
197+
&& password.toByteArray().size <= MAX_PASSWORD_LENGTH_BYTES
200198
}
201199

202200
private suspend fun suspendFinishAuthFlow(tokenResponse: RestResponse): NativeLoginResult {
@@ -245,7 +243,6 @@ internal class NativeLoginManager(
245243
}
246244

247245
private fun createRequestBody(vararg kvPairs: Pair<String, String?>): RequestBody {
248-
// TODO: Review this. If the request body is treated immutably, then filtering null values is a convenient way to handle optional values. ECJ20260312
249246
kvPairs.filter { it.second != null }
250247
val requestBodyString = kvPairs.joinToString("&") { (key, value) -> "$key=$value" }
251248
val mediaType = CONTENT_TYPE_VALUE_HTTP_POST.toMediaTypeOrNull()

0 commit comments

Comments
 (0)