first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SequenceAuth.Example.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]/[action]")]
|
||||
public abstract class ApiControllerBase : ControllerBase
|
||||
{
|
||||
protected Guid UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
var options = HttpContext.RequestServices.GetRequiredService<Microsoft.Extensions.Options.IOptions<SequenceAuth.Lib.SequenceAuthOptions>>().Value;
|
||||
return Guid.Parse(HttpContext.Items[options.UserIdItemKey]?.ToString() ?? throw new UnauthorizedAccessException());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user