1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

Remove Business Portal (#1614)

This commit is contained in:
Oscar Hinton
2021-10-06 10:39:13 +02:00
committed by GitHub
parent fccfce1048
commit 79447b6671
107 changed files with 188 additions and 7196 deletions

View File

@ -684,25 +684,6 @@ 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;
}
[HttpGet("tax")]
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<TaxInfoResponseModel> GetTaxInfo()

View File

@ -30,6 +30,8 @@ namespace Bit.Api.Controllers
private readonly IUserService _userService;
private readonly IPaymentService _paymentService;
private readonly ICurrentContext _currentContext;
private readonly ISsoConfigRepository _ssoConfigRepository;
private readonly ISsoConfigService _ssoConfigService;
private readonly GlobalSettings _globalSettings;
public OrganizationsController(
@ -40,6 +42,8 @@ namespace Bit.Api.Controllers
IUserService userService,
IPaymentService paymentService,
ICurrentContext currentContext,
ISsoConfigRepository ssoConfigRepository,
ISsoConfigService ssoConfigService,
GlobalSettings globalSettings)
{
_organizationRepository = organizationRepository;
@ -49,6 +53,8 @@ namespace Bit.Api.Controllers
_userService = userService;
_paymentService = paymentService;
_currentContext = currentContext;
_ssoConfigRepository = ssoConfigRepository;
_ssoConfigService = ssoConfigService;
_globalSettings = globalSettings;
}
@ -599,5 +605,53 @@ namespace Bit.Api.Controllers
var org = await _organizationService.UpdateOrganizationKeysAsync(new Guid(id), model.PublicKey, model.EncryptedPrivateKey);
return new OrganizationKeysResponseModel(org);
}
[HttpGet("{id:guid}/sso")]
public async Task<OrganizationSsoResponseModel> GetSso(Guid id)
{
if (!await _currentContext.ManageSso(id))
{
throw new NotFoundException();
}
var organization = await _organizationRepository.GetByIdAsync(id);
if (organization == null)
{
throw new NotFoundException();
}
var ssoConfig = await _ssoConfigRepository.GetByOrganizationIdAsync(id);
return new OrganizationSsoResponseModel(organization, _globalSettings, ssoConfig);
}
[HttpPost("{id:guid}/sso")]
public async Task<OrganizationSsoResponseModel> PostSso(Guid id, [FromBody]OrganizationSsoRequestModel model)
{
if (!await _currentContext.ManageSso(id))
{
throw new NotFoundException();
}
var organization = await _organizationRepository.GetByIdAsync(id);
if (organization == null)
{
throw new NotFoundException();
}
var ssoConfig = await _ssoConfigRepository.GetByOrganizationIdAsync(id);
if (ssoConfig == null)
{
ssoConfig = model.ToSsoConfig(id);
}
else
{
ssoConfig = model.ToSsoConfig(ssoConfig);
}
await _ssoConfigService.SaveAsync(ssoConfig);
return new OrganizationSsoResponseModel(organization, _globalSettings, ssoConfig);
}
}
}