mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[SM-460] Isolate SecretsManager files (#2616)
Move SecretsManager files to directories called SecretsManager and add CodeOwners
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
using Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces;
|
||||
using Bit.Api.SecretsManager.Models.Request;
|
||||
using Bit.Api.SecretsManager.Models.Response;
|
||||
using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.SecretsManager.Controllers;
|
||||
|
||||
[SecretsManager]
|
||||
[Route("access-policies")]
|
@ -1,16 +1,15 @@
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Api.SecretsManager.Models.Request;
|
||||
using Bit.Api.SecretsManager.Models.Response;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretManagerFeatures.Projects.Interfaces;
|
||||
using Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.SecretsManager.Controllers;
|
||||
|
||||
[SecretsManager]
|
||||
public class ProjectsController : Controller
|
@ -1,14 +1,13 @@
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Api.SecretsManager.Models.Request;
|
||||
using Bit.Api.SecretsManager.Models.Response;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretManagerFeatures.Secrets.Interfaces;
|
||||
using Bit.Core.SecretsManager.Commands.Secrets.Interfaces;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.SecretsManager.Controllers;
|
||||
|
||||
[SecretsManager]
|
||||
[Authorize("secrets")]
|
@ -1,18 +1,16 @@
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Models.Response.SecretsManager;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
using Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Api.SecretsManager.Models.Request;
|
||||
using Bit.Api.SecretsManager.Models.Response;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces;
|
||||
using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces;
|
||||
using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces;
|
||||
using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.SecretsManager.Controllers;
|
||||
|
||||
[SecretsManager]
|
||||
[Route("service-accounts")]
|
@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class AccessPoliciesCreateRequest
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class AccessPolicyUpdateRequest
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class AccessTokenCreateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class ProjectCreateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class ProjectUpdateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class SecretCreateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class SecretUpdateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class ServiceAccountUpdateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Request;
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class ServiceAccountCreateRequestModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public abstract class BaseAccessPolicyResponseModel : ResponseModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class AccessTokenCreationResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.Models.Response.SecretsManager;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class AccessTokenResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class BulkDeleteResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class ProjectAccessPoliciesResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class ProjectResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class SecretResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class SecretWithProjectsListResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Api.SecretManagerFeatures.Models.Response;
|
||||
namespace Bit.Api.SecretsManager.Models.Response;
|
||||
|
||||
public class ServiceAccountResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace Bit.Api.Utilities;
|
||||
namespace Bit.Api.SecretsManager;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public class SecretsManagerAttribute : Attribute, IResourceFilter
|
@ -15,8 +15,9 @@ using Bit.SharedWeb.Utilities;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
#if !OSS
|
||||
using Bit.Commercial.Core.SecretsManager;
|
||||
using Bit.Commercial.Core.Utilities;
|
||||
using Bit.Commercial.Infrastructure.EntityFramework;
|
||||
using Bit.Commercial.Infrastructure.EntityFramework.SecretsManager;
|
||||
#endif
|
||||
|
||||
namespace Bit.Api;
|
||||
@ -137,7 +138,7 @@ public class Startup
|
||||
#else
|
||||
services.AddCommercialCoreServices();
|
||||
services.AddCommercialSecretsManagerServices();
|
||||
services.AddCommercialEFRepositories();
|
||||
services.AddSecretsManagerEfRepositories();
|
||||
#endif
|
||||
|
||||
// MVC
|
||||
|
@ -1,8 +0,0 @@
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces;
|
||||
|
||||
public interface ICreateAccessTokenCommand
|
||||
{
|
||||
Task<ApiKey> CreateAsync(ApiKey apiKey, Guid userId);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces;
|
||||
|
||||
public interface ICreateProjectCommand
|
||||
{
|
||||
Task<Project> CreateAsync(Project project);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces;
|
||||
|
||||
public interface ICreateSecretCommand
|
||||
{
|
||||
Task<Secret> CreateAsync(Secret secret);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces;
|
||||
|
||||
public interface IUpdateSecretCommand
|
||||
{
|
||||
Task<Secret> UpdateAsync(Secret secret);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces;
|
||||
|
||||
public interface ICreateAccessPoliciesCommand
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces;
|
||||
|
||||
public interface IDeleteAccessPolicyCommand
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces;
|
||||
|
||||
public interface IUpdateAccessPolicyCommand
|
||||
{
|
@ -0,0 +1,8 @@
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces;
|
||||
|
||||
public interface ICreateAccessTokenCommand
|
||||
{
|
||||
Task<ApiKey> CreateAsync(ApiKey apiKey, Guid userId);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
||||
|
||||
public interface ICreateProjectCommand
|
||||
{
|
||||
Task<Project> CreateAsync(Project project);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
||||
|
||||
public interface IDeleteProjectCommand
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces;
|
||||
|
||||
public interface IUpdateProjectCommand
|
||||
{
|
@ -0,0 +1,8 @@
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces;
|
||||
|
||||
public interface ICreateSecretCommand
|
||||
{
|
||||
Task<Secret> CreateAsync(Secret secret);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces;
|
||||
|
||||
public interface IDeleteSecretCommand
|
||||
{
|
@ -0,0 +1,8 @@
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces;
|
||||
|
||||
public interface IUpdateSecretCommand
|
||||
{
|
||||
Task<Secret> UpdateAsync(Secret secret);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces;
|
||||
|
||||
public interface ICreateServiceAccountCommand
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces;
|
||||
namespace Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces;
|
||||
|
||||
public interface IUpdateServiceAccountCommand
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.SecretsManager.Entities;
|
||||
|
||||
public abstract class BaseAccessPolicy
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.SecretsManager.Entities;
|
||||
|
||||
public class ApiKey : ITableObject<Guid>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.SecretsManager.Entities;
|
||||
|
||||
public class Project : ITableObject<Guid>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.SecretsManager.Entities;
|
||||
|
||||
public class Secret : ITableObject<Guid>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.SecretsManager.Entities;
|
||||
|
||||
public class ServiceAccount : ITableObject<Guid>
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.Models.Data;
|
||||
namespace Bit.Core.SecretsManager.Models.Data;
|
||||
|
||||
public class ApiKeyDetails : ApiKey
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.SecretsManager.Repositories;
|
||||
|
||||
public interface IAccessPolicyRepository
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.SecretsManager.Models.Data;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.SecretsManager.Repositories;
|
||||
|
||||
public interface IApiKeyRepository : IRepository<ApiKey, Guid>
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.SecretsManager.Repositories;
|
||||
|
||||
public interface IProjectRepository
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.SecretsManager.Repositories;
|
||||
|
||||
public interface ISecretRepository
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.SecretsManager.Repositories;
|
||||
|
||||
public interface IServiceAccountRepository
|
||||
{
|
@ -4,8 +4,9 @@ using Bit.Core.Context;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Identity;
|
||||
using Bit.Core.IdentityServer;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Models.Data;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
|
@ -1,5 +1,7 @@
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Infrastructure.Dapper.Repositories;
|
||||
using Bit.Infrastructure.Dapper.SecretsManager.Repositories;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Bit.Infrastructure.Dapper;
|
||||
|
@ -1,12 +1,13 @@
|
||||
using System.Data;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Entities;
|
||||
using Bit.Core.SecretsManager.Models.Data;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Infrastructure.Dapper.Repositories;
|
||||
using Dapper;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace Bit.Infrastructure.Dapper.Repositories;
|
||||
namespace Bit.Infrastructure.Dapper.SecretsManager.Repositories;
|
||||
|
||||
public class ApiKeyRepository : Repository<ApiKey, Guid>, IApiKeyRepository
|
||||
{
|
@ -1,6 +1,8 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
@ -1,16 +0,0 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
public class ApiKey : Core.Entities.ApiKey
|
||||
{
|
||||
public virtual ServiceAccount ServiceAccount { get; set; }
|
||||
}
|
||||
|
||||
public class ApiKeyMapperProfile : Profile
|
||||
{
|
||||
public ApiKeyMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.ApiKey, ApiKey>().ReverseMap();
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using Bit.Core;
|
||||
using Bit.Infrastructure.EntityFramework.Converters;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Configurations;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations;
|
||||
|
||||
public class AccessPolicyEntityTypeConfiguration : IEntityTypeConfiguration<AccessPolicy>
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Configurations;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations;
|
||||
|
||||
public class ApiKeyEntityTypeConfiguration : IEntityTypeConfiguration<ApiKey>
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Configurations;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations;
|
||||
|
||||
public class ProjectEntityTypeConfiguration : IEntityTypeConfiguration<Project>
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Configurations;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations;
|
||||
|
||||
public class SecretEntityTypeConfiguration : IEntityTypeConfiguration<Secret>
|
||||
{
|
@ -1,7 +1,9 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations;
|
||||
|
||||
public class ServiceAccountEntityTypeConfiguration : IEntityTypeConfiguration<ServiceAccount>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ServiceAccount> builder)
|
@ -1,8 +1,9 @@
|
||||
using AutoMapper;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
|
||||
public class BaseAccessPolicy : Core.Entities.BaseAccessPolicy
|
||||
public class BaseAccessPolicy : Core.SecretsManager.Entities.BaseAccessPolicy
|
||||
{
|
||||
public string Discriminator { get; set; }
|
||||
}
|
||||
@ -11,13 +12,13 @@ public class AccessPolicyMapperProfile : Profile
|
||||
{
|
||||
public AccessPolicyMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.UserProjectAccessPolicy, UserProjectAccessPolicy>().ReverseMap()
|
||||
CreateMap<Core.SecretsManager.Entities.UserProjectAccessPolicy, UserProjectAccessPolicy>().ReverseMap()
|
||||
.ForMember(dst => dst.User, opt => opt.MapFrom(src => src.OrganizationUser.User));
|
||||
CreateMap<Core.Entities.UserServiceAccountAccessPolicy, UserServiceAccountAccessPolicy>().ReverseMap()
|
||||
CreateMap<Core.SecretsManager.Entities.UserServiceAccountAccessPolicy, UserServiceAccountAccessPolicy>().ReverseMap()
|
||||
.ForMember(dst => dst.User, opt => opt.MapFrom(src => src.OrganizationUser.User));
|
||||
CreateMap<Core.Entities.GroupProjectAccessPolicy, GroupProjectAccessPolicy>().ReverseMap();
|
||||
CreateMap<Core.Entities.GroupServiceAccountAccessPolicy, GroupServiceAccountAccessPolicy>().ReverseMap();
|
||||
CreateMap<Core.Entities.ServiceAccountProjectAccessPolicy, ServiceAccountProjectAccessPolicy>().ReverseMap();
|
||||
CreateMap<Core.SecretsManager.Entities.GroupProjectAccessPolicy, GroupProjectAccessPolicy>().ReverseMap();
|
||||
CreateMap<Core.SecretsManager.Entities.GroupServiceAccountAccessPolicy, GroupServiceAccountAccessPolicy>().ReverseMap();
|
||||
CreateMap<Core.SecretsManager.Entities.ServiceAccountProjectAccessPolicy, ServiceAccountProjectAccessPolicy>().ReverseMap();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
|
||||
public class ApiKey : Core.SecretsManager.Entities.ApiKey
|
||||
{
|
||||
public virtual ServiceAccount ServiceAccount { get; set; }
|
||||
}
|
||||
|
||||
public class ApiKeyMapperProfile : Profile
|
||||
{
|
||||
public ApiKeyMapperProfile()
|
||||
{
|
||||
CreateMap<Core.SecretsManager.Entities.ApiKey, ApiKey>().ReverseMap();
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
using AutoMapper;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
|
||||
public class Project : Core.Entities.Project
|
||||
public class Project : Core.SecretsManager.Entities.Project
|
||||
{
|
||||
public virtual new ICollection<Secret> Secrets { get; set; }
|
||||
public virtual Organization Organization { get; set; }
|
||||
@ -15,7 +16,7 @@ public class ProjectMapperProfile : Profile
|
||||
{
|
||||
public ProjectMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.Project, Project>()
|
||||
CreateMap<Core.SecretsManager.Entities.Project, Project>()
|
||||
.PreserveReferences()
|
||||
.ReverseMap();
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
using AutoMapper;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
|
||||
public class Secret : Core.Entities.Secret
|
||||
public class Secret : Core.SecretsManager.Entities.Secret
|
||||
{
|
||||
public virtual new ICollection<Project> Projects { get; set; }
|
||||
public virtual Organization Organization { get; set; }
|
||||
@ -12,7 +13,7 @@ public class SecretMapperProfile : Profile
|
||||
{
|
||||
public SecretMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.Secret, Secret>()
|
||||
CreateMap<Core.SecretsManager.Entities.Secret, Secret>()
|
||||
.PreserveReferences()
|
||||
.ReverseMap();
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
using AutoMapper;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
|
||||
public class ServiceAccount : Core.Entities.ServiceAccount
|
||||
public class ServiceAccount : Core.SecretsManager.Entities.ServiceAccount
|
||||
{
|
||||
public virtual Organization Organization { get; set; }
|
||||
public virtual ICollection<GroupServiceAccountAccessPolicy> GroupAccessPolicies { get; set; }
|
||||
@ -13,6 +14,6 @@ public class ServiceAccountMapperProfile : Profile
|
||||
{
|
||||
public ServiceAccountMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.ServiceAccount, ServiceAccount>().ReverseMap();
|
||||
CreateMap<Core.SecretsManager.Entities.ServiceAccount, ServiceAccount>().ReverseMap();
|
||||
}
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
using AutoMapper;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Core.SecretsManager.Models.Data;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Repositories;
|
||||
|
||||
public class ApiKeyRepository : Repository<Core.Entities.ApiKey, ApiKey, Guid>, IApiKeyRepository
|
||||
public class ApiKeyRepository : Repository<Core.SecretsManager.Entities.ApiKey, ApiKey, Guid>, IApiKeyRepository
|
||||
{
|
||||
public ApiKeyRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.ApiKeys)
|
||||
@ -27,12 +28,12 @@ public class ApiKeyRepository : Repository<Core.Entities.ApiKey, ApiKey, Guid>,
|
||||
return Mapper.Map<ServiceAccountApiKeyDetails>(entity);
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.ApiKey>> GetManyByServiceAccountIdAsync(Guid id)
|
||||
public async Task<ICollection<Core.SecretsManager.Entities.ApiKey>> GetManyByServiceAccountIdAsync(Guid id)
|
||||
{
|
||||
using var scope = ServiceScopeFactory.CreateScope();
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var apiKeys = await GetDbSet(dbContext).Where(e => e.ServiceAccountId == id).ToListAsync();
|
||||
|
||||
return Mapper.Map<List<Core.Entities.ApiKey>>(apiKeys);
|
||||
return Mapper.Map<List<Core.SecretsManager.Entities.ApiKey>>(apiKeys);
|
||||
}
|
||||
}
|
@ -73,9 +73,6 @@
|
||||
<Build Include="dbo\Functions\PolicyApplicableToUser.sql" />
|
||||
<Build Include="dbo\Functions\UserCipherDetails.sql" />
|
||||
<Build Include="dbo\Functions\UserCollectionDetails.sql" />
|
||||
<Build Include="dbo\Stored Procedures\ApiKey\ApiKeyDetails_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\ApiKey\ApiKey_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\ApiKey\ApiKey_ReadByServiceAccountId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\AuthRequest_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\AuthRequest_DeleteById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\AuthRequest_DeleteIfExpired.sql" />
|
||||
@ -363,8 +360,6 @@
|
||||
<Build Include="dbo\Stored Procedures\User_UpdateKeys.sql" />
|
||||
<Build Include="dbo\Stored Procedures\User_UpdateRenewalReminderDate.sql" />
|
||||
<Build Include="dbo\Stored Procedures\User_UpdateStorage.sql" />
|
||||
<Build Include="dbo\Tables\AccessPolicy.sql" />
|
||||
<Build Include="dbo\Tables\ApiKey.sql" />
|
||||
<Build Include="dbo\Tables\AuthRequest.sql" />
|
||||
<Build Include="dbo\Tables\Cipher.sql" />
|
||||
<Build Include="dbo\Tables\Collection.sql" />
|
||||
@ -385,14 +380,10 @@
|
||||
<Build Include="dbo\Tables\OrganizationSponsorship.sql" />
|
||||
<Build Include="dbo\Tables\OrganizationUser.sql" />
|
||||
<Build Include="dbo\Tables\Policy.sql" />
|
||||
<Build Include="dbo\Tables\Project.sql" />
|
||||
<Build Include="dbo\Tables\ProjectSecret.sql" />
|
||||
<Build Include="dbo\Tables\Provider.sql" />
|
||||
<Build Include="dbo\Tables\ProviderOrganization.sql" />
|
||||
<Build Include="dbo\Tables\ProviderUser.sql" />
|
||||
<Build Include="dbo\Tables\Secret.sql" />
|
||||
<Build Include="dbo\Tables\Send.sql" />
|
||||
<Build Include="dbo\Tables\ServiceAccount.sql" />
|
||||
<Build Include="dbo\Tables\SsoConfig.sql" />
|
||||
<Build Include="dbo\Tables\SsoUser.sql" />
|
||||
<Build Include="dbo\Tables\TaxRate.sql" />
|
||||
@ -404,8 +395,6 @@
|
||||
<Build Include="dbo\User Defined Types\OrganizationUserType.sql" />
|
||||
<Build Include="dbo\User Defined Types\SelectionReadOnlyArray.sql" />
|
||||
<Build Include="dbo\User Defined Types\TwoGuidIdArray.sql" />
|
||||
<Build Include="dbo\Views\ApiKeyDetailsView.sql" />
|
||||
<Build Include="dbo\Views\ApiKeyView.sql" />
|
||||
<Build Include="dbo\Views\AuthRequestView.sql" />
|
||||
<Build Include="dbo\Views\CipherView.sql" />
|
||||
<Build Include="dbo\Views\CollectionView.sql" />
|
||||
@ -436,5 +425,16 @@
|
||||
<Build Include="dbo\Views\SsoUserView.sql" />
|
||||
<Build Include="dbo\Views\TransactionView.sql" />
|
||||
<Build Include="dbo\Views\UserView.sql" />
|
||||
<Build Include="SecretsManager\dbo\Stored Procedures\ApiKey\ApiKeyDetails_ReadById.sql" />
|
||||
<Build Include="SecretsManager\dbo\Stored Procedures\ApiKey\ApiKey_Create.sql" />
|
||||
<Build Include="SecretsManager\dbo\Stored Procedures\ApiKey\ApiKey_ReadByServiceAccountId.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\AccessPolicy.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\ApiKey.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\Project.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\ProjectSecret.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\Secret.sql" />
|
||||
<Build Include="SecretsManager\dbo\Tables\ServiceAccount.sql" />
|
||||
<Build Include="SecretsManager\dbo\Views\ApiKeyDetailsView.sql" />
|
||||
<Build Include="SecretsManager\dbo\Views\ApiKeyView.sql" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user