PM-7585 Show error message when Origin is null, given no support for passkeys from native apps yet (#3175)
This commit is contained in:
parent
96a7d5e089
commit
bfa57ad888
|
@ -6,7 +6,9 @@ using AndroidX.Credentials;
|
|||
using AndroidX.Credentials.Exceptions;
|
||||
using AndroidX.Credentials.Provider;
|
||||
using AndroidX.Credentials.WebAuthn;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Utilities.Fido2.Extensions;
|
||||
using Bit.Droid;
|
||||
|
@ -78,6 +80,13 @@ namespace Bit.App.Platforms.Android.Autofill
|
|||
var origin = callingRequest.Origin;
|
||||
var credentialCreationOptions = GetPublicKeyCredentialCreationOptionsFromJson(callingRequest.RequestJson);
|
||||
|
||||
if (origin is null
|
||||
&&
|
||||
ServiceContainer.TryResolve<IDeviceActionService>(out var deviceActionService))
|
||||
{
|
||||
await deviceActionService.DisplayAlertAsync(AppResources.ErrorCreatingPasskey, AppResources.PasskeysNotSupportedForThisApp, AppResources.Ok);
|
||||
}
|
||||
|
||||
var rp = new Core.Utilities.Fido2.PublicKeyCredentialRpEntity()
|
||||
{
|
||||
Id = credentialCreationOptions.Rp.Id,
|
||||
|
|
|
@ -70,6 +70,13 @@ namespace Bit.Droid.Autofill
|
|||
var packageName = getRequest?.CallingAppInfo.PackageName;
|
||||
var appInfoOrigin = getRequest?.CallingAppInfo.Origin;
|
||||
|
||||
if (appInfoOrigin is null)
|
||||
{
|
||||
await _deviceActionService.Value.DisplayAlertAsync(AppResources.ErrorReadingPasskey, AppResources.PasskeysNotSupportedForThisApp, AppResources.Ok);
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var userInterface = new Fido2GetAssertionUserInterface(
|
||||
cipherId: cipherId,
|
||||
userVerified: false,
|
||||
|
|
|
@ -5281,6 +5281,15 @@ namespace Bit.Core.Resources.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Passkeys not supported for this app.
|
||||
/// </summary>
|
||||
public static string PasskeysNotSupportedForThisApp {
|
||||
get {
|
||||
return ResourceManager.GetString("PasskeysNotSupportedForThisApp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Passkey will not be copied.
|
||||
/// </summary>
|
||||
|
|
|
@ -2987,4 +2987,7 @@ Do you want to switch to this account?</value>
|
|||
<data name="Notice" xml:space="preserve">
|
||||
<value>Notice</value>
|
||||
</data>
|
||||
<data name="PasskeysNotSupportedForThisApp" xml:space="preserve">
|
||||
<value>Passkeys not supported for this app</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
Loading…
Reference in New Issue