mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
two-factor support in browser extensions
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
function ApiService(tokenService, appIdService, utilsService, logoutCallback) {
|
||||
// Desktop
|
||||
// Desktop
|
||||
//this.baseUrl = 'http://localhost:4000';
|
||||
//this.identityBaseUrl = 'http://localhost:33656';
|
||||
|
||||
// Desktop HTTPS
|
||||
// Desktop HTTPS
|
||||
//this.baseUrl = 'https://localhost:44377';
|
||||
//this.identityBaseUrl = 'https://localhost:44392';
|
||||
|
||||
// Desktop external
|
||||
// Desktop external
|
||||
//this.baseUrl = 'http://192.168.1.6:4000';
|
||||
//this.identityBaseUrl = 'http://192.168.1.6:33656';
|
||||
|
||||
// Preview
|
||||
// Preview
|
||||
//this.baseUrl = 'https://preview-api.bitwarden.com';
|
||||
//this.identityBaseUrl = 'https://preview-identity.bitwarden.com';
|
||||
|
||||
// Production
|
||||
// Production
|
||||
this.baseUrl = 'https://api.bitwarden.com';
|
||||
this.identityBaseUrl = 'https://identity.bitwarden.com';
|
||||
|
||||
@@ -43,9 +43,9 @@ function initApiService() {
|
||||
success(new IdentityTokenResponse(response));
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
if (jqXHR.responseJSON && jqXHR.responseJSON.TwoFactorProviders &&
|
||||
jqXHR.responseJSON.TwoFactorProviders.length) {
|
||||
successWithTwoFactor();
|
||||
if (jqXHR.responseJSON && jqXHR.responseJSON.TwoFactorProviders2 &&
|
||||
Object.keys(jqXHR.responseJSON.TwoFactorProviders2).length) {
|
||||
successWithTwoFactor(jqXHR.responseJSON.TwoFactorProviders2);
|
||||
}
|
||||
else {
|
||||
error(new ErrorResponse(jqXHR, true));
|
||||
@@ -54,6 +54,23 @@ function initApiService() {
|
||||
});
|
||||
};
|
||||
|
||||
// Two Factor APIs
|
||||
|
||||
ApiService.prototype.postTwoFactorEmail = function (success, error) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: self.baseUrl + '/two-factor/send-email?' + token,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
success(response);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
handleError(error, jqXHR, false, self);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Account APIs
|
||||
|
||||
ApiService.prototype.getAccountRevisionDate = function (success, error) {
|
||||
|
||||
@@ -13,6 +13,58 @@ function ConstantsService() {
|
||||
Rsa2048_OaepSha1_B64: 4,
|
||||
Rsa2048_OaepSha256_HmacSha256_B64: 5,
|
||||
Rsa2048_OaepSha1_HmacSha256_B64: 6
|
||||
}
|
||||
},
|
||||
twoFactorProvider: {
|
||||
u2f: 4,
|
||||
yubikey: 3,
|
||||
duo: 2,
|
||||
authenticator: 0,
|
||||
email: 1,
|
||||
remember: 5
|
||||
},
|
||||
twoFactorProviderInfo: [
|
||||
{
|
||||
type: 0,
|
||||
name: 'Authenticator App',
|
||||
description: 'Use an authenticator app (such as Authy or Google Authenticator) to generate time-based ' +
|
||||
'verification codes.',
|
||||
active: true,
|
||||
free: true,
|
||||
displayOrder: 0,
|
||||
priority: 1
|
||||
},
|
||||
{
|
||||
type: 3,
|
||||
name: 'YubiKey OTP Security Key',
|
||||
description: 'Use a YubiKey to access your account. Works with YubiKey 4, 4 Nano, 4C, and NEO devices.',
|
||||
active: true,
|
||||
displayOrder: 1,
|
||||
priority: 3
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
name: 'Duo',
|
||||
description: 'Verify with Duo Security using the Duo Mobile app, SMS, phone call, or U2F security key.',
|
||||
active: true,
|
||||
displayOrder: 2,
|
||||
priority: 2
|
||||
},
|
||||
{
|
||||
type: 4,
|
||||
name: 'FIDO U2F Security Key',
|
||||
description: 'Use any FIDO U2F enabled security key to access your account.',
|
||||
active: true,
|
||||
displayOrder: 3,
|
||||
priority: 4
|
||||
},
|
||||
{
|
||||
type: 1,
|
||||
name: 'Email',
|
||||
description: 'Verification codes will be emailed to you.',
|
||||
active: true,
|
||||
displayOrder: 4,
|
||||
priority: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user