1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-07 19:05:07 -05:00

org user management apis

This commit is contained in:
Kyle Spearrin
2017-03-04 21:28:41 -05:00
parent 2f41f260ec
commit 5ac2113cac
20 changed files with 389 additions and 13 deletions

View File

@ -0,0 +1,36 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Bit.Core.Repositories;
using Microsoft.AspNetCore.Authorization;
using Bit.Core.Exceptions;
using Bit.Api.Models;
namespace Bit.Api.Controllers
{
[Route("users")]
[Authorize("Application")]
public class UsersController : Controller
{
private readonly IUserRepository _userRepository;
public UsersController(
IUserRepository userRepository)
{
_userRepository = userRepository;
}
[HttpGet("{id}/public-key")]
public async Task<UserKeyResponseModel> Get(string id)
{
var guidId = new Guid(id);
var key = await _userRepository.GetPublicKeyAsync(guidId);
if(key == null)
{
throw new NotFoundException();
}
return new UserKeyResponseModel(guidId, key);
}
}
}