Add migration to update ApiClients with centralized authorization scopes
This migration updates the ScopesJson for the ApiClient with Id 91000000-0000-0000-0000-000000000001 to include additional authorization scopes for improved API access control. The Down method reverts the changes if necessary.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.SelfService.Portal.Core.API.Authorization;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Add;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Edit;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
|
||||
@@ -10,6 +12,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationRead)]
|
||||
public class DomainController : Controller
|
||||
{
|
||||
private readonly IDomainInterface _domainInterface;
|
||||
@@ -53,6 +56,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult AddDomainById([FromBody] AddDomainDto domain)
|
||||
@@ -83,6 +87,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{Id}")]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -105,6 +110,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPut("{Id}")]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -149,6 +155,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{DomainId}/Environment/{EnvironmentId}")]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationWrite)]
|
||||
[ProducesResponseType(200, Type = typeof(EnvironmentDomainsModel))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult LinkDomainByIdToEnvironment(Guid DomainId, Guid EnvironmentId)
|
||||
@@ -183,6 +190,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{DomainId}/Environment/{EnvironmentId}")]
|
||||
[Authorize(Policy = ApiPolicies.ConfigurationWrite)]
|
||||
[ProducesResponseType(200, Type = typeof(EnvironmentDomainsModel))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult UnlinkDomainByIdFromEnvironment(Guid DomainId, Guid EnvironmentId)
|
||||
|
||||
Reference in New Issue
Block a user