mirror of
https://github.com/bitwarden/server.git
synced 2025-04-15 18:18:12 -05:00
device registration on auth bearer migration
This commit is contained in:
parent
f2d58a3678
commit
5f573355dc
@ -63,7 +63,7 @@ namespace Bit.Api.IdentityServer
|
|||||||
if(user != null && user.SecurityStamp == securityTokenClaim.Value)
|
if(user != null && user.SecurityStamp == securityTokenClaim.Value)
|
||||||
{
|
{
|
||||||
var device = await SaveDeviceAsync(user, context);
|
var device = await SaveDeviceAsync(user, context);
|
||||||
BuildSuccessResult(user, context, null);
|
BuildSuccessResult(user, context, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,10 +177,10 @@ namespace Bit.Api.IdentityServer
|
|||||||
|
|
||||||
private Device GetDeviceFromRequest(ResourceOwnerPasswordValidationContext context)
|
private Device GetDeviceFromRequest(ResourceOwnerPasswordValidationContext context)
|
||||||
{
|
{
|
||||||
var deviceIdentifier = context.Request.Raw["deviceIdentifier"]?.ToString();
|
var deviceIdentifier = context.Request.Raw["DeviceIdentifier"]?.ToString();
|
||||||
var deviceType = context.Request.Raw["deviceType"]?.ToString();
|
var deviceType = context.Request.Raw["DeviceType"]?.ToString();
|
||||||
var deviceName = context.Request.Raw["deviceName"]?.ToString();
|
var deviceName = context.Request.Raw["DeviceName"]?.ToString();
|
||||||
var devicePushToken = context.Request.Raw["devicePushToken"]?.ToString();
|
var devicePushToken = context.Request.Raw["DevicePushToken"]?.ToString();
|
||||||
|
|
||||||
DeviceType type;
|
DeviceType type;
|
||||||
if(string.IsNullOrWhiteSpace(deviceIdentifier) || string.IsNullOrWhiteSpace(deviceType) ||
|
if(string.IsNullOrWhiteSpace(deviceIdentifier) || string.IsNullOrWhiteSpace(deviceType) ||
|
||||||
@ -194,7 +194,7 @@ namespace Bit.Api.IdentityServer
|
|||||||
Identifier = deviceIdentifier,
|
Identifier = deviceIdentifier,
|
||||||
Name = deviceName,
|
Name = deviceName,
|
||||||
Type = type,
|
Type = type,
|
||||||
PushToken = devicePushToken
|
PushToken = string.IsNullOrWhiteSpace(devicePushToken) ? null : devicePushToken
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user