feat(EnvelopeClaimTypes): „envelope ID“ als Auth-Claim hinzugefügt.
This commit is contained in:
parent
bfd4e6a8ed
commit
da28a7332b
@ -52,8 +52,7 @@ namespace EnvelopeGenerator.Application
|
|||||||
|
|
||||||
services.Configure<DispatcherConfig>(dispatcherConfigSection);
|
services.Configure<DispatcherConfig>(dispatcherConfigSection);
|
||||||
services.Configure<MailConfig>(mailConfigSection);
|
services.Configure<MailConfig>(mailConfigSection);
|
||||||
//services.Configure<MailConfig>(mailConfig.GetSection(typeof(MailConfig).ToString()));
|
|
||||||
//IConfigurationSection section = builder.Configuration.GetSection(typeof(T).Name);
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,16 @@
|
|||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||||
{
|
{
|
||||||
public record EnvelopeReceiverReadOnlyCreateDto(
|
public record EnvelopeReceiverReadOnlyCreateDto(
|
||||||
long EnvelopeId,
|
|
||||||
string ReceiverMail,
|
string ReceiverMail,
|
||||||
DateTime DateValid)
|
DateTime DateValid)
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public long? EnvelopeId { get; set; } = null;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
public DateTime AddedWhen { get; } = DateTime.Now;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -18,6 +18,12 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
|
|
||||||
public static string? GetAuthEnvelopeTitle(this ControllerBase controller) => controller.User.FindFirstValue(EnvelopeClaimTypes.Title);
|
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
|
//TODO: integrate localizer for ready-to-use views
|
||||||
public static ViewResult ViewError(this Controller controller, ErrorViewModel errorViewModel) => controller.View("_Error", errorViewModel);
|
public static ViewResult ViewError(this Controller controller, ErrorViewModel errorViewModel) => controller.View("_Error", errorViewModel);
|
||||||
|
|
||||||
|
|||||||
@ -206,7 +206,8 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
new(ClaimTypes.Hash, signature),
|
new(ClaimTypes.Hash, signature),
|
||||||
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())
|
||||||
};
|
};
|
||||||
|
|
||||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
|||||||
@ -9,5 +9,10 @@
|
|||||||
/// Claim type for the title of an envelope.
|
/// Claim type for the title of an envelope.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string Title = $"Envelope{nameof(Title)}";
|
public static readonly string Title = $"Envelope{nameof(Title)}";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Claim type for the ID of an envelope.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string Id = $"Envelope{nameof(Id)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user