mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
PM-10600: Added DeviceType claim
This commit is contained in:
@ -162,6 +162,11 @@ public class CurrentContext : ICurrentContext
|
|||||||
|
|
||||||
DeviceIdentifier = GetClaimValue(claimsDict, Claims.Device);
|
DeviceIdentifier = GetClaimValue(claimsDict, Claims.Device);
|
||||||
|
|
||||||
|
if (Enum.TryParse(GetClaimValue(claimsDict, Claims.DeviceType), out DeviceType deviceType))
|
||||||
|
{
|
||||||
|
DeviceType = deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
Organizations = GetOrganizations(claimsDict, orgApi);
|
Organizations = GetOrganizations(claimsDict, orgApi);
|
||||||
|
|
||||||
Providers = GetProviders(claimsDict);
|
Providers = GetProviders(claimsDict);
|
||||||
|
@ -6,6 +6,7 @@ public static class Claims
|
|||||||
public const string SecurityStamp = "sstamp";
|
public const string SecurityStamp = "sstamp";
|
||||||
public const string Premium = "premium";
|
public const string Premium = "premium";
|
||||||
public const string Device = "device";
|
public const string Device = "device";
|
||||||
|
public const string DeviceType = "devicetype";
|
||||||
|
|
||||||
public const string OrganizationOwner = "orgowner";
|
public const string OrganizationOwner = "orgowner";
|
||||||
public const string OrganizationAdmin = "orgadmin";
|
public const string OrganizationAdmin = "orgadmin";
|
||||||
|
@ -18,6 +18,7 @@ public class ApiResources
|
|||||||
Claims.SecurityStamp,
|
Claims.SecurityStamp,
|
||||||
Claims.Premium,
|
Claims.Premium,
|
||||||
Claims.Device,
|
Claims.Device,
|
||||||
|
Claims.DeviceType,
|
||||||
Claims.OrganizationOwner,
|
Claims.OrganizationOwner,
|
||||||
Claims.OrganizationAdmin,
|
Claims.OrganizationAdmin,
|
||||||
Claims.OrganizationUser,
|
Claims.OrganizationUser,
|
||||||
|
@ -205,6 +205,7 @@ public abstract class BaseRequestValidator<T> where T : class
|
|||||||
if (device != null)
|
if (device != null)
|
||||||
{
|
{
|
||||||
claims.Add(new Claim(Claims.Device, device.Identifier));
|
claims.Add(new Claim(Claims.Device, device.Identifier));
|
||||||
|
claims.Add(new Claim(Claims.DeviceType, device.Type.ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
var customResponse = new Dictionary<string, object>();
|
var customResponse = new Dictionary<string, object>();
|
||||||
@ -546,7 +547,7 @@ public abstract class BaseRequestValidator<T> where T : class
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// checks to see if a user is trying to log into a new device
|
/// checks to see if a user is trying to log into a new device
|
||||||
/// and has reached the maximum number of failed login attempts.
|
/// and has reached the maximum number of failed login attempts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="unknownDevice">boolean</param>
|
/// <param name="unknownDevice">boolean</param>
|
||||||
|
Reference in New Issue
Block a user