1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

added installation id to current context.

This commit is contained in:
Kyle Spearrin
2017-08-10 15:26:05 -04:00
parent e538817eb6
commit 0ad76a5487
5 changed files with 55 additions and 17 deletions

View File

@ -2,6 +2,8 @@
using Microsoft.AspNetCore.Mvc;
using Bit.Core.Services;
using Microsoft.AspNetCore.Authorization;
using Bit.Core;
using Bit.Core.Exceptions;
namespace Bit.Api.Controllers
{
@ -10,16 +12,24 @@ namespace Bit.Api.Controllers
public class PushController : Controller
{
private readonly IPushRegistrationService _pushRegistrationService;
private readonly CurrentContext _currentContext;
public PushController(
IPushRegistrationService pushRegistrationService)
IPushRegistrationService pushRegistrationService,
CurrentContext currentContext)
{
_currentContext = currentContext;
_pushRegistrationService = pushRegistrationService;
}
[HttpGet("register")]
public Object Register()
{
if(!_currentContext.InstallationId.HasValue)
{
throw new BadRequestException("bad request.");
}
return new { Foo = "bar" };
}
}