mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Revert device id in jwt token and moved to reading from header. Added clear token by identifier API/repo/sproc so that token can be cleared after logout.
This commit is contained in:
@ -107,22 +107,12 @@ namespace Bit.Api.Controllers
|
||||
return response;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPut("identifier/{identifier}/clear-token")]
|
||||
[HttpPost("identifier/{identifier}/clear-token")]
|
||||
public async Task<DeviceResponseModel> PutClearToken(string identifier)
|
||||
public async Task PutClearToken(string identifier)
|
||||
{
|
||||
var device = await _deviceRepository.GetByIdentifierAsync(identifier, new Guid(_userManager.GetUserId(User)));
|
||||
if(device == null)
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
device.PushToken = null;
|
||||
await _deviceService.SaveAsync(device);
|
||||
|
||||
var response = new DeviceResponseModel(device);
|
||||
return response;
|
||||
await _deviceRepository.ClearPushTokenByIdentifierAsync(identifier);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
|
Reference in New Issue
Block a user