mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +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
|
// aapt resource value: 0x7f0a0051
|
||||||
public const int ApplicationName = 2131361873;
|
public const int ApplicationName = 2131361873;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00b2
|
// aapt resource value: 0x7f0a00ab
|
||||||
public const int AutoFillServiceDescription = 2131361970;
|
public const int AutoFillServiceDescription = 2131361963;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00b1
|
// aapt resource value: 0x7f0a00aa
|
||||||
public const int AutoFillServiceSummary = 2131361969;
|
public const int AutoFillServiceSummary = 2131361962;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a0050
|
// aapt resource value: 0x7f0a0050
|
||||||
public const int Hello = 2131361872;
|
public const int Hello = 2131361872;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00b3
|
// aapt resource value: 0x7f0a00ac
|
||||||
public const int MyVault = 2131361971;
|
public const int MyVault = 2131361964;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a0027
|
// aapt resource value: 0x7f0a0027
|
||||||
public const int abc_action_bar_home_description = 2131361831;
|
public const int abc_action_bar_home_description = 2131361831;
|
||||||
|
@ -6671,27 +6671,6 @@ namespace Bit.Android
|
||||||
// aapt resource value: 0x7f0a000f
|
// aapt resource value: 0x7f0a000f
|
||||||
public const int common_signin_button_text_long = 2131361807;
|
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
|
// aapt resource value: 0x7f0a0052
|
||||||
public const int hockeyapp_crash_dialog_app_name_fallback = 2131361874;
|
public const int hockeyapp_crash_dialog_app_name_fallback = 2131361874;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
Duo = 2,
|
Duo = 2,
|
||||||
YubiKey = 3,
|
YubiKey = 3,
|
||||||
U2f = 4,
|
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 readonly Dictionary<TwoFactorProviderType, Dictionary<string, object>> _providers;
|
||||||
private TwoFactorProviderType? _providerType;
|
private TwoFactorProviderType? _providerType;
|
||||||
private readonly FullLoginResult _result;
|
private readonly FullLoginResult _result;
|
||||||
|
private readonly string _duoOrgTitle;
|
||||||
|
|
||||||
public LoginTwoFactorPage(string email, FullLoginResult result, TwoFactorProviderType? type = null)
|
public LoginTwoFactorPage(string email, FullLoginResult result, TwoFactorProviderType? type = null)
|
||||||
: base(updateActivity: false, requireAuth: false)
|
: base(updateActivity: false, requireAuth: false)
|
||||||
{
|
{
|
||||||
|
_duoOrgTitle = $"Duo ({AppResources.Organization})";
|
||||||
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
||||||
|
|
||||||
_email = email;
|
_email = email;
|
||||||
|
@ -180,9 +182,10 @@ namespace Bit.App.Pages
|
||||||
Content = scrollView;
|
Content = scrollView;
|
||||||
TokenCell.Entry.FocusWithDelay();
|
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 host = WebUtility.UrlEncode(duoParams["Host"].ToString());
|
||||||
var req = WebUtility.UrlEncode(duoParams["Signature"].ToString());
|
var req = WebUtility.UrlEncode(duoParams["Signature"].ToString());
|
||||||
|
@ -224,7 +227,7 @@ namespace Bit.App.Pages
|
||||||
table.WrappingStackLayout = () => layout;
|
table.WrappingStackLayout = () => layout;
|
||||||
scrollView.Content = layout;
|
scrollView.Content = layout;
|
||||||
|
|
||||||
Title = "Duo";
|
Title = _providerType == TwoFactorProviderType.Duo ? "Duo" : _duoOrgTitle;
|
||||||
Content = scrollView;
|
Content = scrollView;
|
||||||
}
|
}
|
||||||
else if(_providerType == TwoFactorProviderType.YubiKey)
|
else if(_providerType == TwoFactorProviderType.YubiKey)
|
||||||
|
@ -312,6 +315,11 @@ namespace Bit.App.Pages
|
||||||
var beforeProviderType = _providerType;
|
var beforeProviderType = _providerType;
|
||||||
|
|
||||||
var options = new List<string>();
|
var options = new List<string>();
|
||||||
|
if(_providers.ContainsKey(TwoFactorProviderType.OrganizationDuo))
|
||||||
|
{
|
||||||
|
options.Add(_duoOrgTitle);
|
||||||
|
}
|
||||||
|
|
||||||
if(_providers.ContainsKey(TwoFactorProviderType.Authenticator))
|
if(_providers.ContainsKey(TwoFactorProviderType.Authenticator))
|
||||||
{
|
{
|
||||||
options.Add(AppResources.AuthenticatorAppTitle);
|
options.Add(AppResources.AuthenticatorAppTitle);
|
||||||
|
@ -349,6 +357,10 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
_providerType = TwoFactorProviderType.Duo;
|
_providerType = TwoFactorProviderType.Duo;
|
||||||
}
|
}
|
||||||
|
else if(selection == _duoOrgTitle)
|
||||||
|
{
|
||||||
|
_providerType = TwoFactorProviderType.OrganizationDuo;
|
||||||
|
}
|
||||||
else if(selection == AppResources.YubiKeyTitle)
|
else if(selection == AppResources.YubiKeyTitle)
|
||||||
{
|
{
|
||||||
_providerType = TwoFactorProviderType.YubiKey;
|
_providerType = TwoFactorProviderType.YubiKey;
|
||||||
|
@ -448,7 +460,8 @@ namespace Bit.App.Pages
|
||||||
switch(p.Key)
|
switch(p.Key)
|
||||||
{
|
{
|
||||||
case TwoFactorProviderType.Authenticator:
|
case TwoFactorProviderType.Authenticator:
|
||||||
if(provider == TwoFactorProviderType.Duo || provider == TwoFactorProviderType.YubiKey)
|
if(provider == TwoFactorProviderType.Duo || provider == TwoFactorProviderType.YubiKey ||
|
||||||
|
provider == TwoFactorProviderType.OrganizationDuo)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -460,18 +473,26 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TwoFactorProviderType.Duo:
|
case TwoFactorProviderType.Duo:
|
||||||
if(provider == TwoFactorProviderType.YubiKey)
|
if(provider == TwoFactorProviderType.YubiKey ||
|
||||||
|
provider == TwoFactorProviderType.OrganizationDuo)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TwoFactorProviderType.YubiKey:
|
case TwoFactorProviderType.YubiKey:
|
||||||
|
if(provider == TwoFactorProviderType.OrganizationDuo)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var nfcKey = p.Value.ContainsKey("Nfc") && (bool)p.Value["Nfc"];
|
var nfcKey = p.Value.ContainsKey("Nfc") && (bool)p.Value["Nfc"];
|
||||||
if((!_deviceInfoService.NfcEnabled || !nfcKey) && Device.RuntimePlatform != Device.UWP)
|
if((!_deviceInfoService.NfcEnabled || !nfcKey) && Device.RuntimePlatform != Device.UWP)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TwoFactorProviderType.OrganizationDuo:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Other.
|
/// Looks up a localized string similar to Other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1289,4 +1289,8 @@
|
||||||
<data name="AutofillAndSave" xml:space="preserve">
|
<data name="AutofillAndSave" xml:space="preserve">
|
||||||
<value>Auto-fill and save</value>
|
<value>Auto-fill and save</value>
|
||||||
</data>
|
</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>
|
</root>
|
Loading…
Reference in a new issue