mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
Remove checking the EE_TESTING_ENV flag for SM (#2922)
This commit is contained in:
parent
bcf096971b
commit
db8e82ff03
@ -7,7 +7,6 @@ using Bit.Api.Models.Request.Accounts;
|
|||||||
using Bit.Api.Models.Request.Organizations;
|
using Bit.Api.Models.Request.Organizations;
|
||||||
using Bit.Api.Models.Response;
|
using Bit.Api.Models.Response;
|
||||||
using Bit.Api.Models.Response.Organizations;
|
using Bit.Api.Models.Response.Organizations;
|
||||||
using Bit.Api.SecretsManager;
|
|
||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Auth.Enums;
|
using Bit.Core.Auth.Enums;
|
||||||
using Bit.Core.Auth.Repositories;
|
using Bit.Core.Auth.Repositories;
|
||||||
@ -706,7 +705,6 @@ public class OrganizationsController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is a temporary endpoint to self-enroll in secrets manager
|
// This is a temporary endpoint to self-enroll in secrets manager
|
||||||
[SecretsManager]
|
|
||||||
[SelfHosted(NotSelfHostedOnly = true)]
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
[HttpPost("{id}/enroll-secrets-manager")]
|
[HttpPost("{id}/enroll-secrets-manager")]
|
||||||
public async Task EnrollSecretsManager(Guid id, [FromBody] OrganizationEnrollSecretsManagerRequestModel model)
|
public async Task EnrollSecretsManager(Guid id, [FromBody] OrganizationEnrollSecretsManagerRequestModel model)
|
||||||
|
@ -9,13 +9,14 @@ using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces;
|
|||||||
using Bit.Core.SecretsManager.Entities;
|
using Bit.Core.SecretsManager.Entities;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
[Route("access-policies")]
|
[Route("access-policies")]
|
||||||
public class AccessPoliciesController : Controller
|
public class AccessPoliciesController : Controller
|
||||||
{
|
{
|
||||||
|
@ -8,13 +8,14 @@ using Bit.Core.SecretsManager.AuthorizationRequirements;
|
|||||||
using Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
using Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
public class ProjectsController : Controller
|
public class ProjectsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICurrentContext _currentContext;
|
private readonly ICurrentContext _currentContext;
|
||||||
|
@ -12,13 +12,14 @@ using Bit.Core.Services;
|
|||||||
using Bit.Core.Tools.Enums;
|
using Bit.Core.Tools.Enums;
|
||||||
using Bit.Core.Tools.Models.Business;
|
using Bit.Core.Tools.Models.Business;
|
||||||
using Bit.Core.Tools.Services;
|
using Bit.Core.Tools.Services;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
public class SecretsController : Controller
|
public class SecretsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICurrentContext _currentContext;
|
private readonly ICurrentContext _currentContext;
|
||||||
|
@ -6,13 +6,14 @@ using Bit.Core.Exceptions;
|
|||||||
using Bit.Core.SecretsManager.Commands.Porting.Interfaces;
|
using Bit.Core.SecretsManager.Commands.Porting.Interfaces;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
public class SecretsManagerPortingController : Controller
|
public class SecretsManagerPortingController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISecretRepository _secretRepository;
|
private readonly ISecretRepository _secretRepository;
|
||||||
|
@ -3,13 +3,14 @@ using Bit.Core.Context;
|
|||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.SecretsManager.Commands.Trash.Interfaces;
|
using Bit.Core.SecretsManager.Commands.Trash.Interfaces;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
public class TrashController : Controller
|
public class TrashController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICurrentContext _currentContext;
|
private readonly ICurrentContext _currentContext;
|
||||||
|
@ -8,13 +8,14 @@ using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces;
|
|||||||
using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces;
|
using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager.Controllers;
|
namespace Bit.Api.SecretsManager.Controllers;
|
||||||
|
|
||||||
[SecretsManager]
|
|
||||||
[Authorize("secrets")]
|
[Authorize("secrets")]
|
||||||
|
[SelfHosted(NotSelfHostedOnly = true)]
|
||||||
[Route("service-accounts")]
|
[Route("service-accounts")]
|
||||||
public class ServiceAccountsController : Controller
|
public class ServiceAccountsController : Controller
|
||||||
{
|
{
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
|
|
||||||
namespace Bit.Api.SecretsManager;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
|
||||||
public class SecretsManagerAttribute : Attribute, IResourceFilter
|
|
||||||
{
|
|
||||||
public void OnResourceExecuting(ResourceExecutingContext context)
|
|
||||||
{
|
|
||||||
var isDev = context.HttpContext.RequestServices.GetService<IHostEnvironment>().IsDevelopment();
|
|
||||||
var isEE = Environment.GetEnvironmentVariable("EE_TESTING_ENV") != null;
|
|
||||||
if (!isDev && !isEE)
|
|
||||||
{
|
|
||||||
context.Result = new NotFoundResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnResourceExecuted(ResourceExecutedContext context) { }
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user