mirror of
https://github.com/bitwarden/android.git
synced 2026-02-03 18:17:54 -06:00
[PM-31446] fix:Append assetlinks.json path to DAL URLs (#6447)
This commit is contained in:
parent
675b346666
commit
92ba38c831
@ -50,6 +50,8 @@ import kotlinx.coroutines.withContext
|
|||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
|
private const val DAL_ROUTE = ".well-known/assetlinks.json"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary implementation of [BitwardenCredentialManager].
|
* Primary implementation of [BitwardenCredentialManager].
|
||||||
*/
|
*/
|
||||||
@ -123,7 +125,7 @@ class BitwardenCredentialManagerImpl(
|
|||||||
.getSignatureFingerprintAsHexString()
|
.getSignatureFingerprintAsHexString()
|
||||||
.orEmpty(),
|
.orEmpty(),
|
||||||
host = hostUrl,
|
host = hostUrl,
|
||||||
assetLinkUrl = hostUrl,
|
assetLinkUrl = hostUrl.toDigitalAssetLinkUrl(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -316,7 +318,7 @@ class BitwardenCredentialManagerImpl(
|
|||||||
packageName = callingAppInfo.packageName,
|
packageName = callingAppInfo.packageName,
|
||||||
sha256CertFingerprint = signatureFingerprint,
|
sha256CertFingerprint = signatureFingerprint,
|
||||||
host = host,
|
host = host,
|
||||||
assetLinkUrl = host,
|
assetLinkUrl = host.toDigitalAssetLinkUrl(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -428,6 +430,13 @@ class BitwardenCredentialManagerImpl(
|
|||||||
?.relyingParty
|
?.relyingParty
|
||||||
?.id
|
?.id
|
||||||
?.prefixHttpsIfNecessaryOrNull()
|
?.prefixHttpsIfNecessaryOrNull()
|
||||||
|
|
||||||
|
private fun String.toDigitalAssetLinkUrl(): String =
|
||||||
|
when {
|
||||||
|
this.endsWith(DAL_ROUTE) -> this
|
||||||
|
this.endsWith("/") -> "$this$DAL_ROUTE"
|
||||||
|
else -> "$this/$DAL_ROUTE"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val MAX_AUTHENTICATION_ATTEMPTS = 5
|
private const val MAX_AUTHENTICATION_ATTEMPTS = 5
|
||||||
|
|||||||
@ -681,7 +681,8 @@ class BitwardenCredentialManagerTest {
|
|||||||
DEFAULT_PACKAGE_NAME,
|
DEFAULT_PACKAGE_NAME,
|
||||||
DEFAULT_CERT_FINGERPRINT,
|
DEFAULT_CERT_FINGERPRINT,
|
||||||
"https://${mockAssertionOptions.relyingPartyId!!}",
|
"https://${mockAssertionOptions.relyingPartyId!!}",
|
||||||
"https://${mockAssertionOptions.relyingPartyId}",
|
@Suppress("MaxLineLength")
|
||||||
|
"https://${mockAssertionOptions.relyingPartyId}/.well-known/assetlinks.json",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
requestCaptureSlot.captured.origin,
|
requestCaptureSlot.captured.origin,
|
||||||
@ -1499,7 +1500,7 @@ private val DEFAULT_ANDROID_ORIGIN = Origin.Android(
|
|||||||
packageName = DEFAULT_PACKAGE_NAME,
|
packageName = DEFAULT_PACKAGE_NAME,
|
||||||
sha256CertFingerprint = DEFAULT_CERT_FINGERPRINT,
|
sha256CertFingerprint = DEFAULT_CERT_FINGERPRINT,
|
||||||
host = "https://$DEFAULT_HOST",
|
host = "https://$DEFAULT_HOST",
|
||||||
assetLinkUrl = "https://$DEFAULT_HOST",
|
assetLinkUrl = "https://$DEFAULT_HOST/.well-known/assetlinks.json",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
private val DEFAULT_WEB_ORIGIN = Origin.Web("bitwarden.com")
|
private val DEFAULT_WEB_ORIGIN = Origin.Web("bitwarden.com")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user