feat(EnvelopeClaimTypes): „envelope ID“ als Auth-Claim hinzugefügt.

This commit is contained in:
Developer 02
2024-10-09 00:51:59 +02:00
parent bfd4e6a8ed
commit da28a7332b
5 changed files with 19 additions and 5 deletions

View File

@@ -18,6 +18,12 @@ namespace EnvelopeGenerator.Web.Controllers
public static string? GetAuthEnvelopeTitle(this ControllerBase controller) => controller.User.FindFirstValue(EnvelopeClaimTypes.Title);
public static int? GetAuthEnvelopeId(this ControllerBase controller)
{
var env_id_str = controller.User.FindFirstValue(EnvelopeClaimTypes.Id);
return int.TryParse(env_id_str, out int env_id) ? env_id : null;
}
//TODO: integrate localizer for ready-to-use views
public static ViewResult ViewError(this Controller controller, ErrorViewModel errorViewModel) => controller.View("_Error", errorViewModel);