1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-16 00:03:22 +00:00

Converted auth to identity server endpoints and utilize bearer2 access token

This commit is contained in:
Kyle Spearrin
2017-02-04 01:12:25 -05:00
parent 46bb8d2cb5
commit 4a4779fc63
17 changed files with 916 additions and 245 deletions

View File

@@ -1,9 +1,41 @@
namespace Bit.App.Models.Api
using System.Collections.Generic;
namespace Bit.App.Models.Api
{
public class TokenRequest
{
public string Email { get; set; }
public string MasterPasswordHash { get; set; }
public string Token { get; set; }
public int? Provider { get; set; }
public DeviceRequest Device { get; set; }
public IDictionary<string, string> ToIdentityTokenRequest()
{
var dict = new Dictionary<string, string>
{
{ "grant_type", "password" },
{ "username", Email },
{ "password", MasterPasswordHash },
{ "scope", "api offline_access" },
{ "client_id", "mobile" }
};
if(Device != null)
{
dict.Add("DeviceType", Device.Type.ToString());
dict.Add("DeviceIdentifier", Device.Identifier);
dict.Add("DeviceName", Device.Name);
dict.Add("DevicePushToken", Device.PushToken);
}
if(Token != null && Provider.HasValue)
{
dict.Add("TwoFactorToken", Token);
dict.Add("TwoFactorProvider", Provider.Value.ToString());
}
return dict;
}
}
}