refactor(Controllers): FullyAuth-Rollenbedingung für jedes bestehende Auth-Attribut hinzugefügt, um die Autorisierung in Stufen aufzuteilen.
This commit is contained in:
parent
82d8521a25
commit
33fcb5b70e
@ -3,12 +3,12 @@ using EnvelopeGenerator.Common;
|
|||||||
using EnvelopeGenerator.Web.Services;
|
using EnvelopeGenerator.Web.Services;
|
||||||
using EnvelopeGenerator.Application.Contracts;
|
using EnvelopeGenerator.Application.Contracts;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using EnvelopeGenerator.Application;
|
|
||||||
using EnvelopeGenerator.Extensions;
|
using EnvelopeGenerator.Extensions;
|
||||||
|
using static EnvelopeGenerator.Common.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers
|
namespace EnvelopeGenerator.Web.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class DocumentController : BaseController
|
public class DocumentController : BaseController
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost("{envelopeKey}")]
|
||||||
public async Task<IActionResult> Open(string envelopeKey)
|
public async Task<IActionResult> Open(string envelopeKey)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ using EnvelopeGenerator.Extensions;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers
|
namespace EnvelopeGenerator.Web.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class EnvelopeController : BaseController
|
public class EnvelopeController : BaseController
|
||||||
@ -64,7 +64,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost("{envelopeKey}")]
|
||||||
public async Task<IActionResult> Update(string envelopeKey, int index)
|
public async Task<IActionResult> Update(string envelopeKey, int index)
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("reject")]
|
[HttpPost("reject")]
|
||||||
public async Task<IActionResult> Reject([FromBody] string? reason = null)
|
public async Task<IActionResult> Reject([FromBody] string? reason = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,6 @@ using Ganss.Xss;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
using EnvelopeGenerator.Application.DTOs;
|
||||||
using DigitalData.Core.Client;
|
using DigitalData.Core.Client;
|
||||||
using EnvelopeGenerator.Application.Extensions;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers;
|
namespace EnvelopeGenerator.Web.Controllers;
|
||||||
|
|
||||||
@ -321,7 +320,8 @@ public class HomeController : ViewControllerBase
|
|||||||
new(ClaimTypes.Name, er.Name ?? string.Empty),
|
new(ClaimTypes.Name, er.Name ?? string.Empty),
|
||||||
new(ClaimTypes.Email, er.Receiver.EmailAddress),
|
new(ClaimTypes.Email, er.Receiver.EmailAddress),
|
||||||
new(EnvelopeClaimTypes.Title, er.Envelope.Title),
|
new(EnvelopeClaimTypes.Title, er.Envelope.Title),
|
||||||
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString())
|
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString()),
|
||||||
|
new(ClaimTypes.Role, ReceiverRole.FullyAuth)
|
||||||
};
|
};
|
||||||
|
|
||||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
@ -348,7 +348,7 @@ public class HomeController : ViewControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
|
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
|
||||||
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId)
|
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
@ -383,7 +383,7 @@ public class HomeController : ViewControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Rejected")]
|
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Rejected")]
|
||||||
public async Task<IActionResult> EnvelopeRejected(string envelopeReceiverId)
|
public async Task<IActionResult> EnvelopeRejected(string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
@ -489,7 +489,7 @@ public class HomeController : ViewControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpGet("IsAuthenticated")]
|
[HttpGet("IsAuthenticated")]
|
||||||
public IActionResult IsAuthenticated()
|
public IActionResult IsAuthenticated()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using static EnvelopeGenerator.Common.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers
|
namespace EnvelopeGenerator.Web.Controllers
|
||||||
{
|
{
|
||||||
@ -28,7 +29,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
public async Task<IActionResult> CreateAsync([FromBody] EnvelopeReceiverReadOnlyCreateDto createDto)
|
public async Task<IActionResult> CreateAsync([FromBody] EnvelopeReceiverReadOnlyCreateDto createDto)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user