mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
add support for Duo Organization 2FA
This commit is contained in:
parent
10df9e7cd5
commit
ddeae3b5ba
5 changed files with 47 additions and 33 deletions
33
src/Android/Resources/Resource.Designer.cs
generated
33
src/Android/Resources/Resource.Designer.cs
generated
|
@ -6506,17 +6506,17 @@ namespace Bit.Android
|
|||
// aapt resource value: 0x7f0a0051
|
||||
public const int ApplicationName = 2131361873;
|
||||
|
||||
// aapt resource value: 0x7f0a00b2
|
||||
public const int AutoFillServiceDescription = 2131361970;
|
||||
// aapt resource value: 0x7f0a00ab
|
||||
public const int AutoFillServiceDescription = 2131361963;
|
||||
|
||||
// aapt resource value: 0x7f0a00b1
|
||||
public const int AutoFillServiceSummary = 2131361969;
|
||||
// aapt resource value: 0x7f0a00aa
|
||||
public const int AutoFillServiceSummary = 2131361962;
|
||||
|
||||
// aapt resource value: 0x7f0a0050
|
||||
public const int Hello = 2131361872;
|
||||
|
||||
// aapt resource value: 0x7f0a00b3
|
||||
public const int MyVault = 2131361971;
|
||||
// aapt resource value: 0x7f0a00ac
|
||||
public const int MyVault = 2131361964;
|
||||
|
||||
// aapt resource value: 0x7f0a0027
|
||||
public const int abc_action_bar_home_description = 2131361831;
|
||||
|
@ -6671,27 +6671,6 @@ namespace Bit.Android
|
|||
// aapt resource value: 0x7f0a000f
|
||||
public const int common_signin_button_text_long = 2131361807;
|
||||
|
||||
// aapt resource value: 0x7f0a00ac
|
||||
public const int default_web_client_id = 2131361964;
|
||||
|
||||
// aapt resource value: 0x7f0a00ad
|
||||
public const int firebase_database_url = 2131361965;
|
||||
|
||||
// aapt resource value: 0x7f0a00aa
|
||||
public const int gcm_defaultSenderId = 2131361962;
|
||||
|
||||
// aapt resource value: 0x7f0a00ae
|
||||
public const int google_api_key = 2131361966;
|
||||
|
||||
// aapt resource value: 0x7f0a00ab
|
||||
public const int google_app_id = 2131361963;
|
||||
|
||||
// aapt resource value: 0x7f0a00af
|
||||
public const int google_crash_reporting_api_key = 2131361967;
|
||||
|
||||
// aapt resource value: 0x7f0a00b0
|
||||
public const int google_storage_bucket = 2131361968;
|
||||
|
||||
// aapt resource value: 0x7f0a0052
|
||||
public const int hockeyapp_crash_dialog_app_name_fallback = 2131361874;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
Duo = 2,
|
||||
YubiKey = 3,
|
||||
U2f = 4,
|
||||
Remember = 5
|
||||
Remember = 5,
|
||||
OrganizationDuo = 6
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,12 @@ namespace Bit.App.Pages
|
|||
private readonly Dictionary<TwoFactorProviderType, Dictionary<string, object>> _providers;
|
||||
private TwoFactorProviderType? _providerType;
|
||||
private readonly FullLoginResult _result;
|
||||
private readonly string _duoOrgTitle;
|
||||
|
||||
public LoginTwoFactorPage(string email, FullLoginResult result, TwoFactorProviderType? type = null)
|
||||
: base(updateActivity: false, requireAuth: false)
|
||||
{
|
||||
_duoOrgTitle = $"Duo ({AppResources.Organization})";
|
||||
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
||||
|
||||
_email = email;
|
||||
|
@ -180,9 +182,10 @@ namespace Bit.App.Pages
|
|||
Content = scrollView;
|
||||
TokenCell.Entry.FocusWithDelay();
|
||||
}
|
||||
else if(_providerType == TwoFactorProviderType.Duo)
|
||||
else if(_providerType == TwoFactorProviderType.Duo ||
|
||||
_providerType == TwoFactorProviderType.OrganizationDuo)
|
||||
{
|
||||
var duoParams = _providers[TwoFactorProviderType.Duo];
|
||||
var duoParams = _providers[_providerType.Value];
|
||||
|
||||
var host = WebUtility.UrlEncode(duoParams["Host"].ToString());
|
||||
var req = WebUtility.UrlEncode(duoParams["Signature"].ToString());
|
||||
|
@ -224,7 +227,7 @@ namespace Bit.App.Pages
|
|||
table.WrappingStackLayout = () => layout;
|
||||
scrollView.Content = layout;
|
||||
|
||||
Title = "Duo";
|
||||
Title = _providerType == TwoFactorProviderType.Duo ? "Duo" : _duoOrgTitle;
|
||||
Content = scrollView;
|
||||
}
|
||||
else if(_providerType == TwoFactorProviderType.YubiKey)
|
||||
|
@ -312,6 +315,11 @@ namespace Bit.App.Pages
|
|||
var beforeProviderType = _providerType;
|
||||
|
||||
var options = new List<string>();
|
||||
if(_providers.ContainsKey(TwoFactorProviderType.OrganizationDuo))
|
||||
{
|
||||
options.Add(_duoOrgTitle);
|
||||
}
|
||||
|
||||
if(_providers.ContainsKey(TwoFactorProviderType.Authenticator))
|
||||
{
|
||||
options.Add(AppResources.AuthenticatorAppTitle);
|
||||
|
@ -349,6 +357,10 @@ namespace Bit.App.Pages
|
|||
{
|
||||
_providerType = TwoFactorProviderType.Duo;
|
||||
}
|
||||
else if(selection == _duoOrgTitle)
|
||||
{
|
||||
_providerType = TwoFactorProviderType.OrganizationDuo;
|
||||
}
|
||||
else if(selection == AppResources.YubiKeyTitle)
|
||||
{
|
||||
_providerType = TwoFactorProviderType.YubiKey;
|
||||
|
@ -448,7 +460,8 @@ namespace Bit.App.Pages
|
|||
switch(p.Key)
|
||||
{
|
||||
case TwoFactorProviderType.Authenticator:
|
||||
if(provider == TwoFactorProviderType.Duo || provider == TwoFactorProviderType.YubiKey)
|
||||
if(provider == TwoFactorProviderType.Duo || provider == TwoFactorProviderType.YubiKey ||
|
||||
provider == TwoFactorProviderType.OrganizationDuo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -460,18 +473,26 @@ namespace Bit.App.Pages
|
|||
}
|
||||
break;
|
||||
case TwoFactorProviderType.Duo:
|
||||
if(provider == TwoFactorProviderType.YubiKey)
|
||||
if(provider == TwoFactorProviderType.YubiKey ||
|
||||
provider == TwoFactorProviderType.OrganizationDuo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case TwoFactorProviderType.YubiKey:
|
||||
if(provider == TwoFactorProviderType.OrganizationDuo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var nfcKey = p.Value.ContainsKey("Nfc") && (bool)p.Value["Nfc"];
|
||||
if((!_deviceInfoService.NfcEnabled || !nfcKey) && Device.RuntimePlatform != Device.UWP)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case TwoFactorProviderType.OrganizationDuo:
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
|
9
src/App/Resources/AppResources.Designer.cs
generated
9
src/App/Resources/AppResources.Designer.cs
generated
|
@ -2364,6 +2364,15 @@ namespace Bit.App.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Organization.
|
||||
/// </summary>
|
||||
public static string Organization {
|
||||
get {
|
||||
return ResourceManager.GetString("Organization", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Other.
|
||||
/// </summary>
|
||||
|
|
|
@ -1289,4 +1289,8 @@
|
|||
<data name="AutofillAndSave" xml:space="preserve">
|
||||
<value>Auto-fill and save</value>
|
||||
</data>
|
||||
<data name="Organization" xml:space="preserve">
|
||||
<value>Organization</value>
|
||||
<comment>An entity of multiple related people (ex. a team or business organization).</comment>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue