mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
[PM-3430] Refactor organization public key response (#3195)
This commit is contained in:
parent
e0299043a2
commit
795034cd9d
@ -682,8 +682,8 @@ public class OrganizationsController : Controller
|
||||
await _paymentService.SaveTaxInfoAsync(organization, taxInfo);
|
||||
}
|
||||
|
||||
[HttpGet("{id}/keys")]
|
||||
public async Task<OrganizationKeysResponseModel> GetKeys(string id)
|
||||
[HttpGet("{id}/public-key")]
|
||||
public async Task<OrganizationPublicKeyResponseModel> GetPublicKey(string id)
|
||||
{
|
||||
var org = await _organizationRepository.GetByIdAsync(new Guid(id));
|
||||
if (org == null)
|
||||
@ -691,7 +691,14 @@ public class OrganizationsController : Controller
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
return new OrganizationKeysResponseModel(org);
|
||||
return new OrganizationPublicKeyResponseModel(org);
|
||||
}
|
||||
|
||||
[Obsolete("TDL-136 Renamed to public-key (2023.8), left for backwards compatability with older clients.")]
|
||||
[HttpGet("{id}/keys")]
|
||||
public async Task<OrganizationPublicKeyResponseModel> GetKeys(string id)
|
||||
{
|
||||
return await GetPublicKey(id);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/keys")]
|
||||
|
@ -0,0 +1,19 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.Models.Response.Organizations;
|
||||
|
||||
public class OrganizationPublicKeyResponseModel : ResponseModel
|
||||
{
|
||||
public OrganizationPublicKeyResponseModel(Organization org) : base("organizationPublicKey")
|
||||
{
|
||||
if (org == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(org));
|
||||
}
|
||||
|
||||
PublicKey = org.PublicKey;
|
||||
}
|
||||
|
||||
public string PublicKey { get; set; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user