我需要管理Kerberos Resource Based Delegation(C#我知道这更容易,Powershell但这不是要求)。user/computer/service帐户上的属性是msDS-AllowedToActOnBehalfOfOtherIdentity,但这似乎是一些COM我似乎无法处理的对象C#:
static void Main(string[] args)
{
string ou = @"OU=some,OU=ou,DC=corp,DC=com";
string cn = @"someaccount";
DirectoryEntry de = new DirectoryEntry();
de.Username = @"CORP\userwithOUrights";
de.Password = @"password";
de.AuthenticationType = AuthenticationTypes.Secure;
de.Path = $"LDAP://CN={cn},{ou}";
Object a = de.Properties["msDS-AllowedToActOnBehalfOfOtherIdentity"];
}
在此之后a,与其他属性不同,我似乎无能为力。这是一些COM对象,我需要获取其中的帐户。Powershell报告这个属性返回一个System.DirectoryServices.ActiveDirectorySecurity对象,我在这个类中看到有用的方法来解码存储在 AD 等中的二进制格式。但这似乎不是属性调用的返回类型C#。