26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
42 lines
1.1 KiB
C#
Executable File
42 lines
1.1 KiB
C#
Executable File
using System;
|
|
using System.Security.Claims;
|
|
using System.Security.Principal;
|
|
using System.Web.Mvc;
|
|
using DataModel.Models;
|
|
using WebInterface.Security;
|
|
|
|
namespace WebInterface.Controllers
|
|
{
|
|
public class CrudController : Controller
|
|
{
|
|
protected internal IPrincipal CurrentPrincipal
|
|
{
|
|
get { return HttpContext.User; }
|
|
}
|
|
|
|
protected internal LDAPEntry CurrentUser
|
|
{
|
|
get
|
|
{
|
|
LDAPEntry result = null;
|
|
|
|
try
|
|
{
|
|
ClaimsIdentity claimsIdentity = CurrentPrincipal.Identity as ClaimsIdentity;
|
|
|
|
if (claimsIdentity != null)
|
|
{
|
|
UserIdentity identity = new UserIdentity((ClaimsIdentity)HttpContext.User.Identity);
|
|
result = identity.ToLDAPEntry();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
} |