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

generate signin token for enterprise portal (#728)

This commit is contained in:
Kyle Spearrin
2020-05-12 15:36:33 -04:00
committed by GitHub
parent 00af142d63
commit 10a6e12d09
4 changed files with 30 additions and 3 deletions

View File

@ -599,5 +599,24 @@ namespace Bit.Api.Controllers
await _userService.ReinstatePremiumAsync(user);
}
[HttpGet("enterprise-portal-signin-token")]
[Authorize("Web")]
public async Task<string> GetEnterprisePortalSignInToken()
{
var user = await _userService.GetUserByPrincipalAsync(User);
if (user == null)
{
throw new UnauthorizedAccessException();
}
var token = await _userService.GenerateEnterprisePortalSignInTokenAsync(user);
if (token == null)
{
throw new BadRequestException("Cannot generate sign in token.");
}
return token;
}
}
}